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

  1. Create a new workflow and save it as NewThrowWorkflow.xml.
  2. Add a Try Catch activity inside the Sequence.
  3. Inside the Sequence, create a variable named variable1 of the type String and give it the default value "Initial hello"
  4. Create another variable named variable2 of the type System.Object and leave its default value blank.
  5. Click on the Assign Try field of the Try Catch activity.
  6. Drag and drop an Assign activity inside the Try field.
  7. In the To input field of the Assign activity, enter variable1.
  8. In the Value input field of the Assign activity, enter variable2.ToString.

    Your use case should now look like the following screenshot:
  9. Click on the Add new catch button of the Catches field and select System.NullReferenceException from the Exception dropdown field.
  10. Drag and drop a Throw activity inside the Catches field and enter exception in its Exception Misc Property field.
  11. Your use case should now look like the following screenshot:
  12. 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.
  13. Your use case should now look like the following screenshot:

A Workflow Exception will be thrown that should look like this: