Add an error handler for all event callbacks #542

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

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 emberjs/ember.js@99125d9...539f5a1#L0R40 (MIT license).

Owner

madrobby commented Nov 24, 2013

I don't think this is an issue, exceptions are thrown and should pop up in the debugger of your browser, no? I'm unsure about the specific use case here. Feel free to reopen with specific examples.

madrobby closed this Nov 24, 2013

At work we used an exception tracker (there are a few, https://bugsnag.com/, https://airbrake.io, etc.) so that exceptions that happen in production can still be tracked.

Without a change like this, it's basically impossible to get enough information from a crash for an exception report to be useful. The installer you get if you visit https://intro.linkedin.com/ on an iPhone is using this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment