Error Trapping Summary

Error Trapping is a useful and powerful feature of PowerBASIC.  Many programmers avoid trapping errors because of the substantial penalties other BASIC dialects impose when Error Trapping is turned on.  Fortunately, PowerBASIC's hit is much lower.  Still, having Error Trapping turned on may increase the size of your executable.  You may wish to investigate other ways to accomplish the same results, whilst ensuring the stability of your code.

Finally, PowerBASIC now includes the following list of predefined (built-in) equates to assist in the creation of more verbose error handling code.  They include:

%ERR_NOERROR

= 0

%ERR_ILLEGALFUNCTIONCALL

= 5

%ERR_OVERFLOW

= 6 (reserved)

%ERR_OUTOFMEMORY

= 7

%ERR_SUBSCRIPTPOINTEROUTOFRANGE

= 9

%ERR_DIVISIONBYZERO

= 11 (reserved)

%ERR_DEVICETIMEOUT

= 24

%ERR_INTERNALERROR

= 51

%ERR_BADFILENAMEORNUMBER

= 52

%ERR_FILENOTFOUND

= 53

%ERR_BADFILEMODE

= 54

%ERR_FILEISOPEN

= 55

%ERR_DEVICEIOERROR

= 57

%ERR_FILEALREADYEXISTS

= 58

%ERR_DISKFULL

= 61

%ERR_INPUTPASTEND

= 62

%ERR_BADRECORDNUMBER

= 63

%ERR_BADFILENAME

= 64

%ERR_TOOMANYFILES

= 67

%ERR_DEVICEUNAVAILABLE

= 68

%ERR_COMMERROR

= 69

%ERR_PERMISSIONDENIED

= 70

%ERR_DISKNOTREADY

= 71

%ERR_DISKMEDIAERROR

= 72

%ERR_RENAMEACROSSDISKS

= 74

%ERR_PATHFILEACCESSERROR

= 75

%ERR_PATHNOTFOUND

= 76

%ERR_OBJECTERROR

= 99

%ERR_GLOBALMEMORYCORRUPT

= 241 (Previously %ERR_FARHEAPCORRUPT)   

%ERR_STRINGSPACECORRUPT

= 242

 

See Also

Error Overview

Error Trapping

How error traps work

Setting an error trap

Writing an error handler

Exiting an error handler