Error Trapping In Dbase
previous ON ERROR . Description Use ON ERROR as a global error handler for unexpected conditions. For localized error handling—that is, for situations where you expect something might fail, like trying to open a file—use TRY...ENDTRY instead. ON ERROR also acts as a global CATCH; if there is no CATCH for a particular class of exception, an error occurs, which can be handled by ON ERROR. When ON ERROR is active, dBASE Plus doesn't display its default error dialog; it executes the specified . To execute more than one statement when an error occurs, make the DO a program file, or call a function or method. In either case, the code that is executed in response to the error is known as the ON ERROR handler. The ON ERROR handler usually uses the ERROR( ), MESSAGE( ), PROGRAM( ), and LINENO( ) functions to determine what the error is and where it occurred. In most applications, the only safe response to an unexpected condition is to log the error and quit the application. In some cases, you may be able to fix the problem and use the RETRY command to retry the statement that caused the error; or RETURN from the ON ERROR handler, which skips the statement that caused the error and executes the next statement. While dBASE Plus is executing an ON ERROR statement, that particular ON ERROR statement is disabled. Thus, if another error occurs during the execution of , dBASE Plus responds with its default error dialog. You can, however, set another ON ERROR handler inside a routine called with ON ERROR. SET("ON ERROR") returns the current ON ERROR . Avoid using a dBL command recursively with ON ERROR.
Numeric List Trapping Errors You can use the ON ERROR command to designate a subroutine as an error handler. This subroutine is automatically executed when an error condition occurs during runtime. The subroutine can use the following functions to trap errors: ERROR( ) returns a dBASE error number. http://www.dbase.com/help/Everything_Else/IDH_MISCELS_ON_ERROR.htm MESSAGE( ) returns a dBASE error message. DBERROR( ) returns a BDEerror number. DBMESSAGE( ) returns a BDE error message. SQLERROR( ) returns a server error number. SQLMESSAGE( ) returns a server error message. LINENO( ) returns the number of the line http://www.dbase.com/help/Error_Messages/IDH_ERR.htm at which the error occurred. PROGRAM( ) returns the name of the program, procedure, or user-defined function in which the error occurred. The error-handler subroutine can use these returned values to make branching decisions or provide information to the user. ON NETERROR is similar to ON ERROR, except that ON ERROR responds to all run-time errors regardless of whether they're multiuser-specific. You can use ON ERROR to handle both single-user and multiuser errors, or you can use ON NETERROR to handle just multiuser errors. If you issue both ON ERROR and ON NETERROR, then ON ERROR responds to just single-user errors, leaving ON NETERROR to respond to multiuser errors. The CERROR( ) function returns the number of an error that occurs at compile time.
dynDNS.it - DNS dinamico gratuito - Free dynDNS