Share via


Expected 'catch'

You used the exception handling try block, but did not write the associated catch statement. The exception handling mechanism requires that the code that can fail, along with the code that should not execute if an exception occurs, be wrapped inside a try block. Exceptions are thrown from within the try block using the throw statement, and caught outside the try block with one or more catch statements.

To correct this error

  • Add the associated catch block.

  • Try using a finally block instead of a catch block.

See also

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