Description
Throws an exception within a workflow.
Attributes
Misc
Display Name - Renames the activity.
Exception - The exception that would be thrown at execution time
Example
- Create a new workflow and save it as NewThrowWorkflow.xml.
- Add a Try Catch activity inside the Sequence.
- Inside the Sequence, create a variable named variable1 of the type String and give it the default value "Initial hello".
- Create another variable named variable2 of the type System.Object and leave its default value blank.
- Click on the Assign Try field
of the Try Catch activity.
- Drag and drop an Assign activity inside the Try field.
- In the To input field
of the Assign activity, enter variable1.
- In the Value input field
of the Assign activity, enter variable2.ToString.
Your use case should now look like the following screenshot: - Click on the Add new catch button of the Catches field and select System.NullReferenceException from the Exception dropdown field.
- Drag and drop a Throw activity inside the Catches field and enter exception in its Exception Misc Property field.
- Your use case should now look like the following screenshot:
- Finally, click on the Add an activity button of the Finally field then drag and drop a Write Line activity inside the Finally field and enter variable1 in its Text input field.
- Your use case should now look like the following screenshot:
A Workflow Exception will be thrown that should look like this: