Share via

JS5022: Exception thrown and not caught

The code includes a throw statement that is not enclosed within a try block, or the code does not include an associated catch block to trap the error. Exceptions that are thrown from within the try block using the throw statement are caught outside the try block by a catch statement.

To correct this error

  1. Enclose code that can throw an exception in a try block, and ensure there is a corresponding catch block.

  2. Make sure a catch statement expects the correct form of exception.

  3. If the exception is rethrown, make sure there is another corresponding catch statement.

See Also


Error Object

throw Statement

try...catch...finally Statement