DC_ERROR_MSG Function

Returns the text string associated with the negative status code generated by a ā€œDCā€ data import/export function that does not complete successfully.

Usage

    msg_str = DC_ERROR_MSG(status)

Input Parameters

status ā€” The error message number returned by any of the "DC" functions. Must be integer.

Returned Value

msg_str ā€” The test string that corresponds to the value of status. Returns a string; the string is an empty (null) string if status is greater than or equal to 0 (zero).

Keywords

None.

Discussion

When status has a value less than 0 (zero), it indicates a "DC" function error condition, such as an invalid filename, or an unexpected end-of-file.

Because the error message number status includes both the error number and an ID number that corresponds to the "DC" function that produced the error, both the function name and the specific error are described in the message string returned by DC_ERROR_MSG.

Example

The following statements read a file containing 8-bit image data. Depending on the status returned by DC_READ_8_BIT, either an error message is written or the image is displayed in a window the exact size of the image:

; Use DC_READ_8_BIT to read an image file.
status = DC_READ_8_BIT('mongo.img', mongo, XSize=xs, YSize=ys)

IF (status LT 0) THEN BEGIN $
   ; Obtain the error message, if status has a negative value.
   msg_str = DC_ERROR_MSG(status) & $
   ; Print the error message.
   PRINT, msg_str & $
ENDIF ELSE BEGIN
   ; Define a window the right size to hold the image.
   WINDOW, XSize=xs, YSize=ys
   ; Display the image inside the window.
   TVSCL, mongo
ENDELSE

See Also

DC_OPTIONS