Splatzone
Splatzone

Reputation: 151

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 ways I can block the errors?

Thanks!

Upvotes: 1

Views: 232

Answers (1)

Šime Vidas
Šime Vidas

Reputation: 185893

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.

Upvotes: 1

Related Questions