Reputation: 1869
I'm looking for a hook to use whenever an error is fired. I'm aware that you can try/catch but I want something like jQuery's .error but bound to all errors.
Anyone know of anything like this?
Upvotes: 0
Views: 54
Reputation: 23472
Perhaps this is what you are looking for window.onerror
Summary
An event handler for runtime script errors.
Note that some/many error events do not trigger window.onerror, you have to listen for them specifically.
Upvotes: 1