December 2002 Archives

Archive navigation

Using Exception handling in JavaScript 1.5

Dec 11

JavaScript 1.5 (ECMA-262, revision 3) has a host of new functions including error handling this gives developers the ability to make their code more robust when coping with a wide range of unexpected events that could occur.

The try...catch...finally statement lets you safely respond to all types of exceptions. Errors are a type of exception thrown by the JavaScript interpreter when an anomaly such as an out-of-bounds array index, type mismatch, or syntax error occurs. The ECMAScript standard defines six types of errors. In addition, JavaScript 1.5 provides you with the capability to create and throw your own exceptions with the Error object and throw statement.


Continue reading
Filed under: