Purpose | The try ... catch 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 catch clause of the try ... catch statement. The most recent exception raised can be found within the exception object. | |||||
Format |
try { {body} } catch { {exception handler} };
{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 (today() = #29-May-2002#) { throw("No work today!"); }; xout("Here I am at work..."); } catch { xout(_object("exception/description")); }; 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. |