Core.Actions.Handler
Jump to navigation
Jump to search
Classification
Name | Handler |
Short Description | Activity for the treatment of exceptions |
Class | Compound Node |
Extension | OTX Core library |
Group | Compound node related actions |
Exceptions | - |
Checker Rules | Core_Chk016 |
Standard Compliant | Yes |
OTL Syntax
try
{
...
}
catch (ExceptionType ExceptionVariable)
{
...
}
finally
{
}
Description
The OTX handler activity is used for Exception Handling. Is intended for unexpected behavior within a procedure, which is caused by Exceptions, see Throw activity. The handler activity consists of the following three blocks:
- Try
- The try block contains the section on exceptions to be monitored. An exception is thrown, processing interrupted and the matching the exception catch block is executed.
- Catch
- The catch block is the actual exception handling. Each handler activity has at least one catch block. Each catch block can be assigned to one exception (exception). If a matching catch block is found, no additional catch blocks are processed. If no matching catch block is found, the error handling to the next outer sequence is passed. An exception is raised in a catch block, this is also propagated to the next outer sequence.
- Finally
- The optional finally block is the cleanup of resources and is always executed, regardless of whether an exception or not occurred.
Throws an exception within the observed block (Try Block) these can be handled within the Catch Blocks. A Finally Block exists, it runs in any case after the try or catch block.
Important: If an activity can throw exceptions, lists the types of exceptions in the description of the activity. |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Try | Exception | Value | - | [1] | This property is valid only in the CATCH sector. |
Catch | Exception | Variable | - | [0..1] | This property is valid only in the CATCH sector. |
OTL Examples
List<Integer> listOfInteger = {1, 2, 3};
Integer result1;
OutOfBoundsException outOfBoundException;
String result2;
String result3;
// listOfInteger is a list of 3 items
try
{
result1 = listOfInteger[6];
}
catch (OutOfBoundsException outOfBoundException)
{
result2 = "I got an OutOfBoundException";
}
finally
{
result3 = "I am in a Finally section";
}