MAINSAIL Language Manual, Section 34.6

previous   next   top   contents   index   framed top   this page unframed


34.6. errMsg

Figure 34–7. errMsg
BOOLEAN
PROCEDURE   errMsg      (OPTIONAL STRING msg,val;
                         
OPTIONAL BITS ctrlBits);

errMsg raises an exception. If no handler handles the exception, a message is written to logFile and a response obtained from cmdFile.

If $doNotRaise is not set in ctrlBits, errMsg raises the predefined exception denoted by $systemExcpt by calling $raise with the following arguments:

$raise($systemExcpt,msg,val,NULLPOINTER,$returnIfNoHandler!ctrlBits)

In the case of fatal errors, it sets the $cannotReturn bit in the call to $raise; otherwise, if no handler handles the exception, control returns to errMsg and errMsg writes the message specified by its arguments.

errMsg returns FALSE if a handler handling the $systemExcpt exception calls $raiseReturn, in which case no message is written to logFile and no response read from cmdFile. Otherwise, the message is written, and errMsg returns TRUE.

When the message is written, ERROR: is written to logFile, followed by the STRING msg. If val is not the empty STRING it is written after the message, preceded by a blank. Finally, Error response: is written on a new line to signify that a response is requested; the following responses are valid:

Response Meaning
<eol> Continue execution (exit from MAINSAIL if fatal error).
QUIT Exit MAINSAIL.
MAINSAIL: Abort program Exit the current program.
EXECUTE m/f Execute MODULE m or MODULE in file f.
CALLS {c} Show (to logFile) a list of the calls (most recent first) in coroutine c. If c is omitted, the call chain for the current coroutine is shown, i.e., the call sequence that led to the call to errMsg. For each PROCEDURE call made, the MODULE in which the call was made is shown, followed by the decimal offset of the call in the MODULE. See the description of DISASM in Chapter 5 of the MAINSAIL Compiler User's Guide for a description of how to find the source code corresponding to the decimal offsets for non-debuggable MODULEs (use the DEBUG response to find the source code for debuggable MODULEs).
DEBUG Enter MAINDEBUG, the MAINSAIL debugger.
GUIDEBUG Enter the GUI form of the debugger. This works only if a GUI debugger (e.g., MAINSAIL's Motif-based tools) has been installed.
@ Enter MAINEDIT, the MAINSAIL editor (no effect if MAINEDIT is already running).
?? Rewrite the error message and the Error response: prompt.
? Show a list of valid responses.

Other responses may be shown if the appropriate exceptions have been registered by means of $registerException. Section 20.10 explains how errMsg responses may be abbreviated.

Valid predefined BITS constants for ctrlBits are:

Bit Effect
$doNotRaise Do not call $raise; just write the message.
warning Write WARNING: instead of ERROR: before the message. Do not get a response.
fatal Write FATAL: instead of ERROR: before the message. Do not allow execution to continue.
noResponse Do not get a response.
msgMe Write the name of the PROCEDURE that called errMsg and the decimal offset within its MODULE's control section at which the call to errMsg occurred. If the invoking coroutine is not the root coroutine MAINSAIL, its name is written as well.
msgMyCaller Write the name of the most recently entered PROCEDURE in the current coroutine that called errMsg's caller but is in a different MODULE from errMsg's caller, and write the decimal offset within its MODULE's control section at which the call to errMsg's caller's MODULE occurred. If the invoking coroutine is not the root coroutine MAINSAIL, its name is written as well.
$formatAsParagraph If $formatAsParagraph is set, errMsg calls $formParagraph for each separate line in its error message before writing the message to logFile. This usually results in a tidier-looking error message. The call to $formParagraph occurs after $systemExcpt is raised (if it is raised), so the $formatAsParagraph bit does not affect the format of the exception STRING arguments.

previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 34.6