How to use an Error Event Node
After finishing this tutorial you will be able to use the Error Event Node properly and learn how to incorporate them
into your PAK Workflows in the Editor.
|An Error Event Node is a division point of the business process. It triggers the execution of a different flow, if an error occurs.
When using tasks or commands, we can sometimes expect that an error is going to occur,
maybe it’s due to unpredictable circumstances or simply user produced.
We might have an alternative way to successfully end the workflow in case something goes wrong.
In cases where errors occur, we want to take a different execution path, so that these errors can be handled accordingly.
We can achieve this by using the Error Event Node.
We want a specific file to be opened from the users file directory, but we are not sure if the file exists.
Therefore, we can use the Error Event Node to catch the error, that would occur when accessing a non-existing file.
If the user does not have the file, we can decide what to do instead, in our case we will just log the value we wanted to write to the file.
For the tasks, that may produce errors, select the Error Event from the Workflow Controls and then click on the error producing task.
The Error Event Node will be added to the task.Figure 3. Workflow before adding Error Event NodeFigure 4. Selecting the Error-Event from Workflow ControlsFigure 5. Workflow after Error Event Node was added
Add the properties for the Error Event Node, i.e. the keys under which the Data from the error will be saved in the Runtime Datastore.
By adding a unique name for the code and message of the individual errors, the code or message can be accessed and used later on.
|If the same names will be chosen for the variables from multiple errors the values will be overwritten.
Name: The name of the error
Error Code Variable: The name for the key, under which the error code will be saved.
A list of possible (but not all) error codes can be found here.
Error Message Variable: The name for the key, under which the error message will be saved.Figure 6. Configuration of the Error Event Node
Lastly, add an alternative Path for what should be done if an error occurs.Figure 7. Finished Workflow
This is the path we took, as an error happened:
This is the data written into the Runtime Datastore:
And the corresponding logs: