Reference Guide

1-34 RPL Programming
To artificially cause a built-in error to occur in a program:
1.
Enter the error number (as a binary integer or real number) for the error.
2.
Enter the DOERR command (PRG ERROR menu).
If DOERR is trapped in an IFERR structure (described in the next topic), execution continues. If it’s not trapped,
execution is abandoned at the DOERR command and the error message appears.
To analyze an error in a program:
To get the error number for the last error, execute ERRN (PRG ERROR menu).
To get the error message for the last error, execute ERRM (PRG ERROR menu).
To clear the last-error information, execute ERR0 (PRG ERROR menu).
The error number for a user-defined error is #70000h. See the list of built-in error numbers in appendix A, “Error
and Status Messages”.
Example:
The following program aborts execution if the list in level 1 contains three objects.
«
OBJ
IF 3 ==
THEN "3 OBJECTS IN LIST" DOERR
END
»
The following table summarizes error trapping commands.
Error Trapping Commands
Key Programmable
Command
Description
L L
%ERROR%
:
%DOERR%
DOERR Causes an error. For a string in level 1, causes a user-defined error: the
calculator behaves just as if an ordinary error has occurred. For a binary
integer or real number in level 1, causes the corresponding built-in error.
If the error isn’t trapped in an IFERR structure, DOERR displays the
message and abandons program execution. (For 0 in level 1, abandons
execution without updating the error number or message — like
.)
%ERRN%
ERNN Returns the error number, as a binary integer, of the most recent error.
Returns
#0
if the error number was cleared by ERR0.
%ERRM%
ERRM
Returns the error message (a string) for the most recent error. Returns
an empty string if the error number was cleared by ERR0.
%ERR0%
ERR0 Clears the last error number and message.