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:
-
ON ERROR Command
-
Error Event
-
Visual FoxPro system handler
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.