Tell JavaScript To Ignore NullReferenceException?


I get a lot of "NullReferenceException" warnings in my console, and it just clutters up the place - I know the reason why its a null, but is there a way to silence the scripts errors? Or for it to ignore null errors?


You might consider writing code that is more fail safe. You should be checking against NULL. The first time you’re trying to figure out why something isn’t executing and figure out it’s b/c you threw a NULL exception three lines above it, you’ll remember this and think “Damn, my code sucks.” Start sucking less now.

Try this, it should work:

  //Run some code here
  //Handle errors here

I used to do this when programing in Java