Hi There,
Glad you are finding intercooler useful! :)
Regarding error handling, in my experience there are two major classes of errors: inline form related errors and then global "out of band" errors.
For inline errors, the best thing to do is to flag the errors inline in the HTML you return (e.g. highlight an input field red with a descriptive error message).
For global errors, I typically use a custom event with a listener hooked up on the page body that invokes something like bootstrap notify:
or jGrowl or whatever looks right in your app.
Then you can trigger the event using the IC-Trigger header, with the error message passed down as an argument to the event, so you'll have a header like this:
IC-Trigger:{"user-error", ["A bad thing happened. Sorry."]}
and a handler like this:
$('body').on('user-error', function(event, msg) {
$.notify({ message: msg },{ type: 'danger'});
});
This ensures that the error is seen by the user. I also route all rails flash messages through this handler to unify the look and feel, but that's a rails specific idea.
Finally, I should mention the ic-post-errors to attribute, which will post all errors (including client side errors) to the specified URL:
This is a nice feature that people should use, if only to collect error information about their site. There are also attributes you can use to trigger scripts on various AJAX events, all of which begin with 'ic-on':
Hope that helps.
Cheers
Carson