An
interesting article at xml.com explaining how to use XMLHttpRequest to post client-side Javascript errors to the server, where the log files reside.
As AJAX brings more code to the client, it also brings more bugs there. And it therefore becomes important to catch errors and provide some fallbacks rather than letting the user in front of a non-functional page with a little "there was an error on the page" yellow triangle that certainly doesn't make him confident.
Another way of reducing the risk of errors is to reduce the application-specific Javascript code to its bare minimum and use a well-tested generic framework. That's the approach we've been using in the
AJAX mode of Cocoon Forms.