How to Capture an Exception

Hello,

I am finding the best way to handle Exceptions is to place each part of your flow chart or state machine in an Invoke Workflow file and surround it with a Try/Catch. Then to capture the Exception use an Assign inside the Catch part.
For example,

Assign exceptionMessage = "Workflow123 — "+ exception.Source + ": " + exception.Message

I put “Workflow123” to represent the workflow file or part of the process being called, exception.Source in the Catch will give you the Activity where the error occurred, and exception.Message gives you the Exception message. Also, exception.Source really only works if the workflow file is Invoked.

Regards.

3 Likes