Reputation: 599
Is there some way to wrap the entire page in a try/catch, so that I can catch any error from any script that is executing?
Upvotes: 29
Views: 9032
Reputation: 169451
Turn on the debugger and break on error.
You don't want to catch every error in the entire page on production code. That's horrible.
Upvotes: -5
Reputation: 12545
Use window.onerror
instead of a big try/catch
.
You could actually do some useful things in the error handler, like posting the error information to your server so you know when things are breaking on your page.
Upvotes: 50