Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes

.\

cgerrormsg.pro


top cgErrorMsg

Utilities

result = cgErrorMsg( [theMessage] [, /Error] [, /Informational], Traceback=Traceback [, /NoName] [, Title=string] [, /Quiet], _Extra=_Extra)

The purpose of this function is to have a device-independent error messaging function. The error message is reported to the user by using DIALOG_MESSAGE if widgets are supported. Otherwise, the error message is just printed to standard out.

Parameters

theMessage in optional type=string

This is a string argument containing the error message you want reported. If undefined, this variable is set to the string in the !Error_State.Msg system variable.

Keywords

Error in optional type=boolean default=1

Set this keyword to cause Dialog_Message to use the ERROR reporting dialog. Note that a longstanding bug in IDL causes the ERROR dialog to be used whether this keyword is set to 0 or 1!

Informational in optional type=boolean default=0

Set this keyword to cause Dialog_Message to use the INFORMATION dialog instead of the WARNING dialog. Note that a bug in IDL causes the ERROR dialog to be used if this keyword is set to 0!

Traceback
NoName in optional type=boolean default=0

Normally, the name of the routine in which the error occurs is prepended to the error message. Setting this keyword will suppress this behavior and no routine name will be used.

Title in optional type=string

Set this keyword to the title of the DIALOG_MESSAGE window. By default the keyword is set to 'System Error' unless !ERROR_STATE.NAME equals "IDL_M_USER_ERR", in which case it is set to "Trapped Error'. traceback: in, optional, type=boolean, default=1 Setting this keyword results in an error traceback being printed to standard output with the PRINT command. Use TRACEBACK=0 to turn this functionality off.

Quiet in optional type=boolean default=0

Set this keyword to suppress the DIALOG_MESSAGE pop-up dialog.

_Extra

Examples

In general, the cgErrorMsg function is not called directly. Rather, it is used in a CATCH error handler. Errors are thrown to cgErrorMsg with the MESSAGE command. A typical CATCH error handler is shown below:

Catch, theError IF theError NE 0 THEN BEGIN Catch, /Cancel void = cgErrorMsg() RETURN ENDIF
Error messages will get into the cgErrorMsg function by throwing an error with the MESSAGE command, like this:
IF test NE 1 THEN Message, 'The test failed.'

Author information

Author:

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright:

Copyright (c) 2013, Fanning Software Consulting, Inc.

History:

Change History:

Written by: David W. Fanning, 27 April 1999. Added the calling routine's name in the message and NoName keyword. 31 Jan 2000. DWF. Added _Extra keyword. 10 February 2000. DWF. Forgot to add _Extra everywhere. Fixed for MAIN errors. 8 AUG 2000. DWF. Adding call routine's name to Traceback Report. 8 AUG 2000. DWF. Added ERROR, INFORMATIONAL, and TITLE keywords. 19 SEP 2002. DWF. Removed the requirement that you use the NONAME keyword with the MESSAGE command when generating user-trapped errors. 19 SEP 2002. DWF. Added distinctions between trapped errors (errors generated with the MESSAGE command) and IDL system errors. Note that if you call ERROR_MESSAGE directly, then the state of the !ERROR_STATE.NAME variable is set to the *last* error generated. It is better to access ERROR_MESSAGE indirectly in a Catch error handler from the MESSAGE command. 19 SEP 2002. DWF. Change on 19 SEP 2002 to eliminate NONAME requirement did not apply to object methods. Fixed program to also handle messages from object methods. 30 JULY 2003. DWF. Removed obsolete STR_SEP and replaced with STRSPLIT. 27 Oct 2004. DWF. Made a traceback the default case without setting TRACEBACK keyword. 19 Nov 2004. DWF. Added check for window connection specifically for CRON jobs. 6 May 2008. DWF. Added QUIET keyword. 18 October 2008. DWF. The traceback information was bypassed when in the PostScript device. Not what I had in mind. Fixed. 6 July 2009. DWF. The QUIET keyword was clearing traceback information. Fixed with help from Phillip Bitzer. 2 Oct 2012. DWF. Name changed to cgErrorMsg from Error_Message, 4 November 2013, by David W. Fanning.

File attributes

Modification date: Fri Mar 27 11:07:35 2015
Lines: 265
Docformat: rst rst