try function
Syntax
try
Protected StatementList
catchQualifiedID &ID
StatementList
end-try
Description
Use the try statement as part of a try-catch block to trap exceptions thrown either by the system or by using the CreateException function.
Parameters
| Parameter | Description |
|---|---|
|
Protected StatementList |
Specify the statements that are protected by the try-catch block. |
|
catch QualifiedID &ID |
Specify the catch statement at the end of the list of statements you want to protect. |
|
QualifiedID |
Specify what class of exception you are catching—that is, Exception or the name of a class extending the Exception class. |
|
&ID |
Specify a variable to be set with the caught exception. |
|
StatementList |
Specify the steps to be taken once the exception is caught. |
Returns
None.
Example
try
&res = 15.3 / 7 * 22.1;
catch Exception &c1
MessageBox(0, "", 0, 0, "Caught exception: " | &c1.ToString());
end-try;