Purpose | The <try> ... <exception> statement is used to monitor a section of the Superx++ program for any exceptions that may be raised/thrown. 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 |
<try> {body} <exception> {exception handler} </exception> </try>
{body} |
the set of Superx++ statements to monitor for a raised exception |
{exception handler} |
the set of Superx++ statements to be executed when an exception is raised within the <try> statement |
|
|
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. |