Error handling demo

When a JavaScript error happens because of server error/incorrect url (500, 404) the only way you would know the reason is by using something like firebug/chrome dev tools (by looking in the console for the execution of ajax requests).

You can also assign a js function to the awe.err, this way whenever an error will occur your custom function will be executed (this code is called in utils.init).
utils.js
awe.err = function (o, xhr, textStatus, errorThrown) {
var msg = "unexpected error occured";
if (xhr) {
msg = xhr.responseText || msg;
}

awem.notif(msg, 0, 'err');

// close popup that got error
if (o.p && o.p.isOpen) {
o.p.d.data('api').close();
}
};

clicking on this popup links will throw a server exception, click on them to see how it's handled