| Purpose | The <throw> statement is used to raise/throw an exception within a <try> ... <exception> statement. Whenever an exception is thrown it is trapped in the <exception> clause of the <try> ... <exception> statement. The most recent exception raised can be found within the exception object. | |||
| Format |
<throw> {exception desc} </throw>
{exception desc} |
a text description of the exception |
|
|
| Example #1 |
<try> <if> <cond> <eval> <expr>today() = #29-May-2002#</expr> </eval> </cond> <true> <throw>No work today!</throw> </true> <false> </false> </if> <xout> Here I am at work... </xout> <exception> <xout> <eval object="exception/description" /> </xout> </exception> </try> Prints the string No work today! to the output stream if the date is 29th May 2002; otherwise, prints the text Here I am at work... to the output stream. |
|||