MAINSAIL Language Manual, Section 46.1

previous   next   top   contents   index   framed top   this page unframed


46.1. $raise

Figure 46–1. $raise
PROCEDURE   $raise      (OPTIONAL STRING exceptionName,
                             
exceptionStringArg1,
                             
exceptionStringArg2;
                         
OPTIONAL POINTER
                             
exceptionPointerArg;
                         
OPTIONAL BITS ctrlBits;
                         
PRODUCES OPTIONAL BITS
                             
resultBits;
                         
OPTIONAL POINTER($coroutine)
                             
raiseeCoroutine);

$raise either causes the occurrence of an exception or propagates the current exception, depending on the value of exceptionName.

If exceptionName is not the null STRING, $raise causes an occurrence of the exception denoted by exceptionName. In this case, exceptionStringArg1, exceptionStringArg2, and exceptionPointerArg are assumed to contain extra information about the exception that a handler can access by means of the system PROCEDUREs $exceptionStringArg1, $exceptionStringArg2, and $exceptionPointerArg.

Table 46–2 shows the valid predefined BITS constants for ctrlBits. To require that control eventually be returned to the current point, an exception may be raised with the ctrlBits $cannotFallOut!$returnIfNoHandler.

Table 46–2. Predefined BITS Constants for $raise ctrlBits
Bit Meaning
$cannotReturn Do not permit a call to $raiseReturn for this exception. The exception must be handled by falling out of a handler.
$returnIfNoHandler If no handler handles the exception, ignore the exception and return from $raise.
$cannotFallOut Error occurs if a handler attempts to handle the exception by falling out (or by terminating with DONE, CONTINUE, or RETURN statement).

The only valid predefined BITS constants for resultBits is $noHandler. If set, it means control returned from $raise because $returnIfNoHandler was set in ctrlBits and there was no handler.

If exceptionName is the null STRING, the current exception is propagated to another handler and the parameters exceptionStringArg1, exceptionStringArg2, exceptionPointerArg, and ctrlBits are ignored. If there is no current exception, a system exception is raised.

raiseeCoroutine indicates the coroutine in which the exception should first be raised (the raisee coroutine). A Zero value denotes the current coroutine (the raiser coroutine).

The exception may be either a user exception or a predefined exception.


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 46.1