Best practices for handling server errors


I have been struggling for a while in finding a way to correctly handle server generated errors. For example, if I have a business rule that gets broken while trying to insert/update an event, I would like to show the appropriate message and action to follow or at least the exception message that generated the error.

So far, I have managed to receive an error status by adding the following snippet

On the View

    dp.attachEvent("onAfterUpdate", function (sid, action, tid, tag) {
        if (action == "error") {
            alert("Ther was an error");
            return false;

but I would like to show a more descriptiive message depending on the error received.

How can I receive additional data on the event processing function?


we’ve added DataAction.Message property, you can pass additional info with it.
server:[code]catch (Exception a)
action.Type = DataActionTypes.Error;
action.Message = a.Message;

return (new AjaxSaveResponse(action));[/code]
and recieve it on the clientdp.attachEvent("onAfterUpdate", function (sid, action, tid, tag) { if (action == "error") { alert(tag.textContent); return false; } });

The latest version of the component is available on site