try { <level> } "{"
<commands>
"}"
catch <exception> "{"
<commands>
"}"
try: Execute a command block which detects exceptions.
catch: Catch an exception detected within the corresponding try command block.
<level>
A numeric value indicating which severity level of exceptions are to be detected.
If during execution of the command block an exception is thrown with a severity level greater than
<level> it is ignored. If this parameter is
omitted, then the value of throw_level is assumed, or 6 if
throw_level has not been set.
<exception>
An exception identifier with details of the caught exception. If this identifier
does not exist a local exception is created.
<commands>
A series of language commands to be executed within the try
or catch block.
none
Two types of exception can be thrown within a try block: system exceptions and user exceptions:
System exceptions are thrown as a result of language or data errors detected by the system. This is done automatically without any user action.
User exceptions are thrown by a throw command, typically executed as a result of an error detected by application macro code.
Exceptions detected within a try command block may be thrown in the current command frame or in sub-frames, e.g. called functions or procedures.
Code to catch a maths warning:
try 10 { numeric x = sqrt(-10);# A mathematical anomaly # We will never get here } catch exc { # Just list the error details list exc }
Commands: |
|
Functions: |
|
Identifiers: |
throw_level (numeric) |
Structures: |