madrobby/zepto — pull request #542 by ConradIrwin (2012-07-06 02:53:29+00:00)
Title: Add an error handler for all event callbacks

Javascript has a default error handler `window.onerror` though there are several issues with this, the most poignant being that you can't get at the error object itself, nor the associated stack trace.

Due to the large amount of code that ends up being run as a direct consequence of user-interaction on a webpage, allowing developers to catch all errors that are raised within event handlers added by zepto allows significantly improved debugging ability (particularly when coupled to a service like Airbrake or Bugsnag).

Obviously this is no substitute for handling errors locally; but it does significantly help with tracking down hard to find problems and unexpected exceptions.

This patch was inspired by a similar change made to ember.js https://github.com/emberjs/ember.js/compare/99125d9...539f5a1#L0R40 (MIT license).