How can I suppress all javascript errors which occur, including those in the console?
I'm trying to find a way to suppress all javascript errors that occur, including those that are invoked from the firebug/chrome console.
It's not that my code is buggy or anything, it's more of an experiment :)
Window.error is only working to a limited degree, are there any other wa开发者_StackOverflow社区ys I can block the errors?
Thanks!
What do you mean by "invoked from the console"? JavaScript errors are thrown based on the code.
If you want to prevent the error console in the browser to report any errors, then place all code inside try-catch:
try {
// all the code
} catch(e) {}
But once an error is thrown, the statements that follow are not executed, so the idea is to not have any errors thrown in the first place.
精彩评论