Unhandled Structured Exception (Error 2059)

Visual Studio .NET 2003

An unhandled exception can occur under the following conditions:

  • An error that occurred or exception that was thrown in a TRY, CATCH, or FINALLY block was not caught by a structured error handler such as TRY...CATCH...FINALLY.
  • A structured error handler did not catch a thrown exception that occured outside a TRY...CATCH...FINALLY structure.

You can catch an unhandled structured exception using the following unstructured exception handlers:

For each of these error handlers, the error number returned by the ERROR( ) function is 2059. Visual FoxPro provides details about the original error. You can also obtain additional information about the original error that caused the unhandled exception from the SYS(2018) - Error Message Parameter, MESSAGE( ), and AERROR( ) functions. The SYS(2018) function returns the same value as the third element in the array returned by the AERROR( ) function. The MESSAGE( ) function returns the same value as the second element in the array returned by AERROR( ).

If the unhandled exception was caused by a THROW statement, the value of SYS(2018) is 2071, or User Thrown Error.