This recipe is dedicated to showing how to handle errors in workflows. We will learn how to catch errors and redirect them.
We just need a working Orchestrator, and you will need the rights to create new workflows and run them. We will work with the Orchestrator Client.
Create a new workflow. We will reuse this workflow in the recipe, Resuming failed workflows in Chapter 4, Programming Skills.
Add the following variables:
Name
Type
Section
Use
number
Number
IN
Used to create an intentional error
Assemble the workflow (as seen in the following screenshot) by dragging a Scriptable task into the workflow and then a Throw exception element from the generic section onto the Scriptable task. Add the two log elements to the workflow by just dropping them onto the lines:
Bind the in-parameter to the scriptable task and add the following script, which will throw an error when the value
5
is entered:if (number==5) { ...