Routines (alphabetical) > Routines: S > STRMESSAGE

# STRMESSAGE

The STRMESSAGE function returns the text of the error message specified by Err. This function is especially useful in conjunction with the CODE field of the !ERROR_STATE system variable which always contains the error number of the last error. The MSG field of the !ERROR_STATE system variable contains the text of the last error message.

## Examples

Print the error message associated with error number 4 by entering:

PRINT, STRMESSAGE(4)

## Syntax

Result = STRMESSAGE( Err [, /BLOCK | , /CODE | , /NAME] )

## Return Value

Returns the error message text.

## Arguments

### Err

The error number or text. Programs must not make the assumption that certain error numbers are always related to certain error messages—the actual correspondence changes over time as IDL is modified.

## Keywords

### BLOCK

Set this keyword to return the name of the message block that defines Err. If this keyword is specified, Err must be an error code.

### CODE

Set this keyword to return the error code for the error message specified in Err. If this keyword is specified, Err must be an error name.

### NAME

Set this keyword to return a string containing the error message that goes with Err. If this keyword is specified, Err must be an error code.

## Version History

Original | Introduced

## See Also

MESSAGE