Using the Throw Activity

I mentioned this very early in the book, but I haven’t really reinforced this basic concept—workflows model processes. Therefore, we need to be able to model a wide variety of real-world situations, including the case where we need to throw an exception. Suppose that something along the way wasn’t quite right, and the situation was not one our software could deal with in any other way than to throw an exception. We could, if we wanted, just throw an exception using the C# throw keyword, but using a special activity for this allows us to also use a special activity for handling exceptions, as we’ll see in the next section. If we use the C# throw keyword, the workflow runtime "swallows" the exception, with no notice given. ...

Get Microsoft® Windows® Workflow Foundation Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.