When an exception is thrown with InvokeRPA, it cannot be caught

Hi Allen,
I am a student,I use InvokeRPA in the Try of TryCatch and throw an exception through InvokeRPA, but I cannot Catch the exception in catch. The thrown exception is the same as the caught exception, and only prompts me that flow block 2 failed at xxx(time).I hope you can help me solve this problem.Thank you.

Invoke openrpa does not thow the same exception, it creates a new exception. So if you need the exact same exception you need to catch it in the original flow

image

In the context of the diagram, I’m utilizing the “Invoke OpenRPA” control to invoke a process block that contains a New System.Exception() throw. The Catch block is set to catch an exception of type System.Exception , and it does output the content of the exception, but not the details of the exception. However, if an exception is directly thrown within the Try block, it can be successfully caught.

Maybe I’m misunderstanding what you are writing, but for me it sounds like you are confirming what i just wrote. Invoke Open will throw a new exception , not the exception thrown in the workflow.
So if you need to catch the real exception you need to do it, in the workflow that throws it.

Thank you Allan, I would like to ask you another question, how to implement the exception direction of process blocks through OpenRPA, as shown in the following figure.


The gray line is the normal direction, and the yellow line is the abnormal direction. When Block1 is abnormal, Block2 is executed; otherwise, Block2 is not executed

Have a look at flow diagrams ( search for “flow” in toolbox )

I’m sorry, I didn’t understand what you said. I only found the following content in the toolbox. Could you give me more details.
image

you can remove the main sequence in your workflow, and drag in a “Flowchart”
Then use “FlowDecision” to direct the flow
You can add sequences inside the flow diagram to segment your code.

example from workitem template.
image

Yes, you are right, but if I am not sure what error will occur, I only know that block 1 will execute block 2 when an error occurs. What to do in this case

there are several ways ( i think )
but the quick and dirty would be to add
boolean variable at the root scope, to check for errors,
then use a try/catch around block one and set the boolean variable accordingly
and then use switch statement to redirect the flow according to the boolean value ?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.