CATCH (trap exception)

Top 

 

CATCH

statements

 

 

CATCH

Trap an exception

statements

any language statement to execute when an exception is detected.

 

CATCH is used with the arming of the TRY statement to process any exceptions detected by TRY. If any exception occurs with TRY, the control transfers to the appropriate CATCH section, and later to the FINALLY section.

CATCH is optional. TRY can exist either with one or more CATCH statements or a single FINALLY statement, or with both. At least one CATCH or FINALLY statement must be present.

 

Example:

 

CODE

TRY

 F()  !calling a function

CATCH (Exception e)

  MESSAGE('Exception in code: ' & e.Message)

 FINALLY

  !Any cleanup code here

END