JavaScript Editor js editor     Web development 



Main Page

Returns the error number for the error that triggered an ON ERROR routine.

ERROR(В )

Return Value

Numeric

Remarks

ERROR(В ) returns the number of the most recent error. An ON ERROR routine must be active for ERROR(В ) to return a value other than 0.

When an error is trapped during program execution, the error type can be returned by ERROR(В ) in an ON ERROR routine. The corresponding error message can be returned by MESSAGE(В ).

The value ERROR(В ) returns is reset by RETURN or RETRY.

Example

The following example demonstrates a simple error-handling routine that displays a message when an error occurs.

В Copy Code
CLEAR
ON ERROR DO errhand WITH ERROR( ), MESSAGE( )

*** The next line generates an error - there is no BRWSE command

BRWSE
ON ERROR
RETURN

*** Error handler ***

PROCEDURE errhand
PARAMETER errnum,message
? Message 
? 'Error number: '+ ALLTRIM(STR(Errnum))
RETURN

See Also



JavaScript Editor js editor     Web development