JavaScript Editor js editor     Web development 

Main Page

After an application starts executing, errors can occur at run time. For example, errors can occur at run time from the following actions:

You can handle such errors, including errors that occur in reports and those due to tables with bad database back links, by using the error handlers that Visual FoxPro provides. However, if your application does not contain error-handling routines when an error occurs at run time, the application pauses, and the appropriate Visual FoxPro system error message appears with the following buttons:

For a list and explanation of Visual FoxPro error messages, see Error Messages.

For errors that you cannot avoid, make sure to provide documentation that describes errors that users might see and suggest ways to correct those errors.

Using Error Handling Routines

You can use the Visual FoxPro language to create error-handling routines for error conditions. The following topics explain several mechanisms for handling run-time errors in code and the order of their operation:

Running the Most Recently Executed Line of Code

You can use the RETRY command, except with TRY...CATCH...FINALLY, to run a line of code that caused an error after changing conditions that caused the error.

Sometimes, the line of code that caused an error does not exist for you to execute with RETRY. The Error event can occur even when the error encountered is not associated with a line of your code. For example, if you call a data environment's CloseTables method in code when the AutoCloseTables property is set to True (.T.) and then release the form, Visual FoxPro generates an internal error when it attempts to close the tables again. You can trap the error; however, no line of code exists for you to execute with RETRY.

For more information, see RETRY Command.

See Also

JavaScript Editor js editor     Web development