Thursday, March 5th, 2009
You can throw an by using the throw operator and providing an object to throw. Any type of object can be thrown, however, an Error object is the most typical to use:
- throw new Error("Something bad happened.")
When you throw an error in this way, and the error isn’t caught via a try-catch statement, the browser will display the error text in the browser’s typical way.
He provides a few more details on how error handling works in browsers, and then goes on to assert that:
Posted by Ben Galbraith at 12:52 am