Writing an error handler

When an error occurs and an error trap invokes your error-handling routine, the first thing the code should do is to determine which error occurred.  PowerBASIC's ERR and ERRCLEAR functions return the code of the most recent error.  You can use one of PowerBASIC's control structures (like SELECT CASE) to take appropriate action based on the error code.  The ERROR$ function can be used to help formulate a suitable error message to log or report to the user.

 

See Also

Error Overview

How error traps work

Setting an error trap

Exiting an error handler

Error Trapping Summary