Returns the current error message or the program line that caused the error.
MESSAGE([1]) |
Parameters
- [1]
-
Return the program source code that caused the error if MESSAGE(В ) is included in an ON ERROR routine.
If the program source code is not available,
Note: MESSAGE(1)
is not available in the runtime.MESSAGE(1)
returns one of the following:-
The entire program line if the line is macro-substituted.
-
A command if the line contains a command without any additional clauses.
-
A command followed by three dots (...) if the line contains a command and additional clauses.
-
The entire program line if the line is macro-substituted.
Return Value
Character. MESSAGE(В ) returns the current error message as a character string or the contents of the program line causing the error.
Remarks
Unlike ERROR(В ), MESSAGE(В ) is not reset by RETURN or RETRY.
Example
The following example displays output using the MESSAGE(В ) function.
В | Copy Code |
---|---|
ON ERROR DO Errhand *** The next line should generate an error *** USE Nodatabase ON ERROR && Restore system error handler. PROCEDURE Errhand ? 'Line of code with error: ' + MESSAGE(1) ? 'Error number: ' + STR(ERROR( )) ? 'Error message: ' + MESSAGE( ) |