Condividi tramite


MESSAGE( ) Function

Returns either the current error message as a character string or the contents of the program line that caused the error.

MESSAGE([1])

Return Values

Character

Parameters

  • 1
    If MESSAGE( ) is used in an ON ERROR routine, include this argument to return the program source code that caused the error. If the program source code is not available, 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.

Remarks

Unlike ERROR( ), MESSAGE( ) is not reset by RETURN or RETRY.

Example

The following example displays output from MESSAGE( ) and MESSAGE(1).

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( )

See Also

ERROR Command | ERROR( ) | ON ERROR | AERROR( ) Function | Error Messages A-Z | Error Messages by Number