$ERR


General Form:
$ERR

The $ERR alphanumeric function is used to return the last error code as a string in the form cXX.YYY where c is a character representing the class of error, XX is the major error number in the range 00 to 99, and YYY is the minor number that uniquely identifies the particular error. Error classes are related to major error numbers thus:

ClassMajor errorsDescription
A00 to 09System errors
S10 to 29Syntax errors
O30 to 30Object errors
P31 to 59Run time errors
C60 to 69Maths errors
X70 to 79Conversion errors
D80 to 89Disk errors
I90 to 99Device errors

This function is valid anywhere a string expression is legal. Unlike ERR it is not reset until the next error ocurs. A typical full codes might be:

C62.001 Division by zero
P57.017 Length of substring zero or negative
P34.109 Reference to grid cell (10,11) in grid sized (10,10)

User errors signalled by THROW ERR are returned as "I90.000" whatever their value.

Prior to KCML 6.0 $ERR was implemented as ERR$(ERR) which meant that it was reset when used. Prior to KCML 6.20 the full error text was not included if the error was handled by a ERROR clause as the text came from a separate berror.d file. As of 6.20 the text of all errors is included in KCML and is looked up for all classes of error in all circumstances. Note that for many errors the text is dynamic and reflects the components involved in the error (as in the P34 grid cell range error above.)

Do not assume that the error text or the minor error numbers will stay fixed in future versions of KCML.

As of KCML 7.02, when executing under the control of the test harness, the optional string associated with a STOP statement will be copied to $ERR when the STOP executes. If there was no string then $ERR will be cleared.

Syntax examples:

major_err$ = STR($ERR,2,2)
minor_err$ = STR($ERR,5,3)

See also:

ERR, ERR$(), $OSERR, ERROR