Share via


Exception thrown and not caught

You included a throw statement in your code, but it was not enclosed within a try block, or there was no associated catch block to trap the error. Exceptions are thrown from within the try block using the throw statement, and caught outside the try block with a catch statement.

To correct this error

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

  • Make sure your catch statement expects the correct form of exception.

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

See also

Error Object
throw Statement
try...catch...finally Statement