Partager via


Exception Class

When an error occurs in the TRY block within a TRY...CATCH...FINALLY error handling structure, Visual FoxPro creates an Exception object automatically and uses the VarName memory variable specified in the CATCH TO clause to store a reference to the exception. The THROW command also generates an Exception object. However, if no TRY...CATCH...FINALLY structure traps the thrown exception, Visual FoxPro escalates the exception another error handler or Visual FoxPro's global error handler.

You can define and subclass the Exception class.

Exception 

Remarks

Visual FoxPro supports the Exception class only in program (.prg) files.

Exception objects do not support all the various error information, including Component Object Model (COM), Open Database Connectivity (ODBC), and database triggers, that you can usually obtain from the AERROR() function. However, you can access AERROR() information inside the TRY...CATCH block.

Example

oError = CREATEOBJECT("exception")

See Also

Objects, Collections, and Classes | Exception Object Properties, Methods, and Events | TRY...CATCH...FINALLY Command | Structured Error Handling