Reference Manual - Table of Contents Error Handling The commands and functions described in this section describe what can be done when a application created in Visual MacStandardBasic encounters an error when executing. See Appendix A and Appendix B for a listing of runtime and compiler error messages.
Command Summary:
OnError SubFunction Summary:
var = ErrorNum( )
var$ = ErrorMsg ( )
OnError Sub
This command is used to call a Sub procedure if an error occurs. Normally when an error occurs an alert message box will be displayed showing the error # and message. Once the user acknowledges it by clicking on the OK command button, the application terminates.
By using the OnError command to call a Sub procedure instead the alert message box is not displayed. The Sub procedure called is responsible for handling the error. You can use the ErrorNum and ErrMsg functions to determine what error has occurred.
Sub - This is a reference to the a SUB procedure that will be called when an error occurs during the execution of an application created in MacStandardBasic. Use NONE to designate that no Sub procedure should be called.
var = ErrorNum( )
This function returns the number of the last error.
var$ = ErrorMsg( )
This function returns a text string that is the error message of the last error.