Runtime Exception Question

Hi,

I have a Main sequence that has try catch block.

Within try catch I have Invoke Workflow Sub1, Invoke workflow Sub2, Invoke workflow Sub3.

  1. When sub flow cannot find an element to click, it is throwing an error alert. I do not want this alert to show up, because user has to click ok.

  2. But I want the main process to know that there is an error so it handles the exception. How?

  3. I do not get this alert in debug mode, why?
    Thank you so much,

Hi,

Use TryCatch activity surrounding the Click then show message to click OK in Catch block.

But I want the main process to know that there is an error so it handles the exception. How?

Define out type argument in sub workflow then set something if exception occurs.
For example, exception type variable.

I do not get this alert in debug mode, why?

If it seems debug catch exception before runtime exception message, can you try to turn on ContinueOnException on Ribbon menu?

Regards,

1 Like

@Yoichi
Kindly show an example, how to do this please? How do I send this from sub to Main? Thank you,

Hi,

Can you try the following sample? (Please input non-integer value in a dialog box to occur exception. And it may be better to turn on ContinueOnException for understanding its behavior)

Sample20240701-4.zip (4.3 KB)

Regards,

1 Like

Thank you. Got the continue on Exception.

So in the main process, I have to set the System Exception to returned argument form the sub, correct?
Main:
Invokeworkflow

SystemException = out argument.

Thank you,

Yes, as the following, in the above sample.

Regards,

@Yoichi
Thank you so much. It is not clear to me, the ex out argument sent by sub flow - how to set it to system exception in main?

Since main is enclosed in try catch, why the sub flow exception not getting caught by try catch in main?

Thank you,

In the above sample, if exception occurs ex variable (out type argument) is set as the Exception in catch block. If no exception occurs, ex variable is Nothing.
So in main, we can check if exception occurs in sub to check content of ex.
if ex is Nothing, there is no exception in sub.
if ex is not Nothing, exception which is ex occurs in sub.

Since main is enclosed in try catch, why the sub flow exception not getting caught by try catch in main?

Because the exception is caught by the TryCatch in sub. If you want to catch it directly by TryCatch in Main, rethrow will help you.

Regards,

1 Like

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