JavaScript provides a try-catch statement that is capable of intercepting thrown errors
before they are handled by the browser. The code that might cause an error comes in
the try block and code that handles the error goes into the catch block. For instance:
try {
somethingThatMightCauseAnError();
} catch (ex) {
handleError(ex);
}
before they are handled by the browser. The code that might cause an error comes in
the try block and code that handles the error goes into the catch block. For instance:
try {
somethingThatMightCauseAnError();
} catch (ex) {
handleError(ex);
}