Partilhar via


Using the ThrowActivity Activity

The purpose of the ThrowActivity activity is to raise exceptions declaratively, usually in response to exceptional conditions detected in a workflow.

The ThrowActivity activity can point to an exception object in the workflow that is derived from Exception, using the Fault property; if the Fault property is set to a specific exception instance, setting the FaultType property is not required. The execution of the ThrowActivity activity throws the exception object in the .NET Framework sense, which is using the C# throw statement. This is equivalent to a code handler of an activity throwing the exception in user code.

For more information, see the ThrowActivity class of the System.Workflow.ComponentModel namespace in the Windows Workflow Foundation Class Library reference, and see Fault Handling in Workflows.

For a code sample that demonstrates how to use the ThrowActivity activity, see Using Throw.

See Also

Reference

ThrowActivity

Concepts

Fault Handling in Workflows

Other Resources

Throw Sample
Windows Workflow Foundation Activities