How to Capture an Exception

Hi There,

I need your help guys … I’m running a workflow and when I print the exception showed me that:

The activity ‘WaitImageAppear’ with ID 108 threw or propagated an exception while being canceled

I cannot to find where is the error …I guess that could be in a pick branch, I have a few On Image Appears Activities but I need to capture this error and i dont know how.

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

Yes, I have a invoke workflow file with a try/catch and this one capture the exception but also inside that other workflow I put a try catch and this one didn´t capture the exception, just the outside workflow. Well, now with your logic I think that I have a better idea how to handle this. Thank you very much