Try statement
Thetry statement contains the code you want to run but acknowledge might fail at some point.
The definition has 2 parts:
- keyword try
- 1 or more statements, enclosed in curly brackets - {} must always be used
Catch statement
Thecatch statement contains the code to run if an exception is thrown from the try block.
The definition has 2 parts:
- keyword catch
- 1 or more statements, enclosed in curly brackets - {} must always be used
Built-in exceptions
The built-in classes and functions of CRMScript may throw exceptions, which you can catch. Inside thecatch block, you can use the following implicit String variables:
- error - a status code or description of the error
- errorLocation - the location where the exception was thrown
Custom exceptions
You can also throw you own exceptions from thetry block.
The throw statement has 2 parts:
- keyword throw
- a string (in quotes) followed by a semicolon
throw statement inside a try block. If you throw an exception outside try, it will eventually be caught by us and shown as if the script failed.