STRMESSAGE Function
Returns the text of the error message specified by the input error number.
Usage
result = STRMESSAGE(errno)
Input Parameters
errno—The error number for which the message text is desired.
Returned Value
result—The text of the error message specified by errno.
Keywords
None.
Discussion
This function is especially useful in conjunction with the !Err system variable, which always contains the error number of the last error.
However, you should take care not to make the assumption in your programs that certain error numbers always correspond to certain error messages, as this correspondence may change as PV‑WAVE is modified over time.
Example
The following procedure uses function STRMESSAGE to display the error message associated with an input/output error trapped by procedure ON_IOERROR.
; Define a function to read, and return a 100-element,
; floating-point array.
FUNCTION strmessage_ex1, file_name
; Declare error label.
ON_IOERROR, bad
; Open the file and use the Get_Lun keyword to allocate a
; logical file unit.
OPENR, unit, file_name, /Get_Lun
; Define data array.
a = FLTARR(100)
; Read data.
READU, unit, a
; Clean up and return.
GOTO, DONE
; Exception label.
BAD:
; Print the error message associated with the error number in
; !ERROR. Note that STRMESSAGE is used to display the message.
PRINT, "STRMESSAGE: " + STRMESSAGE(!ERROR)
DONE:
; Close and free the input/output unit.
FREE_LUN, unit
; Return result. Variable a is undefined if an error occurred.
RETURN, a
END
See Also
System Variables:
!Err,
!Err_StringFor more information on error handling, see the PV‑WAVE Programmer’s Guide.
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.