Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 3 Current »

TryCatch

This activity contains activities to be executed by the workflow runtime in an exception handling block.

The purpose of this activity is to enclose another activity or group of activities that are prone to throwing exceptions and therefore stop the workflow with unknown results. One can

Activity Parameters

The TryCatch activity has has no parameters other than its DisplayName that can be changed for easier comprehension of the workflow/area it's in.


Example:

Our example is part of a workflow that adds an Active Directory user.

What the activity does is try to create the Active Directory user, and if the user creation activity fails for reasons such as insufficient AD rights for the user that runs the workflow, the catch statement will log an entry with a clear exception.

In our example, the exception will be displayed in the workflow trackdata.

Were it not for the TryCatch activity enclosing the CreateUser activity, in case of an issue with the CreateUser activity the workflow would have failed with no explanation given whatsoever.

Throw

This activity is used to break the execution of a workflow at a user defined moment by throwing an exception.

Activity Parameters

The Throw activity has one parameter and it can be provided by manually inserted values or via IN arguments or variables

Parameters:

  • Exception (text box editor type) (type: System.Exception): the exception that will be thrown. The value must be new Exception ("the_error_message_you_would_like_to_display").


Example:

Our example is part of a workflow that adds creates an Active Directory user.

What this segment does is check whether the user exists in the AD or not, and if it doesn't, it will create the user in a TryCatch activity. If the user exists, the workflow will stop executing and display an error message (in our case: "Error: user already exists.").

Tracking data:

Rethrow

 

 

 

  • No labels