Try Catches

I am pretty new to the programming world and am trying to figure out how to get the try-catch to work correctly. I have my entire process within the try-catch, and I am trying to get it, so if it fails, it will automatically try again. I intentionally have a spot in the process to make it fail, but when it fails, I have it set in the try-catch to retry the scope with the entire process again. The only problem here is when it fails, it doesn’t go through the retry scope; it just fails the process. Any ideas on what I can do to get the operation to restart completely?



Hi,

Can you try not Debug but Run.

OR

Can you try to turn on ContinueOnException on Debug tab then run Debug mode?

Regards,

@Yoichi Thank you. That was helpful, but I still do have the same problem. I am getting it to fail, but when it fails, it ends the process before it does the retry scope. Is that normal, or am I going about this the wrong way?

Hi,

Can you check if GlobalExcepionHadler exists in your project?
(Or can you share screenshot of project panel?)

Regards,

@Yoichi, Not sure I understand what that is, but here is a screenshot of the project panel.

HI,

There seems no GlobalHandler…
Can you try to turn on LogActivites on ribbon menu, then debug run?
And can you share log messages of the above result in Output panel? if its size is large, it might be better to attach as txt file.

Regards,

1 Like

22.10.3+Branch.master.Sha.def2351dc828ccfbcddb6e9e07c9cf71b5bf55da

Source: Click ‘Setup’

Message: Could not find the user-interface (UI) element for this action.

Possible solutions:
• Ensure application is opened and the UI element is visible on the screen at execution time
• Edit the Target of the UI activity and use Validation to debug the issue.
• If needed, re-indicate the element as its properties might have changed
• Use “Check state” activity to check the application state before executing the action
• Increase the “Delay before” value to allow time to the application to render entirely and become responsive

Exception Type: UiPath.UIAutomationNext.Exceptions.NodeNotFoundException

UiPath.UIAutomationNext.Exceptions.NodeNotFoundException: Could not find the user-interface (UI) element for this action.

Possible solutions:
• Ensure application is opened and the UI element is visible on the screen at execution time
• Edit the Target of the UI activity and use Validation to debug the issue.
• If needed, re-indicate the element as its properties might have changed
• Use “Check state” activity to check the application state before executing the action
• Increase the “Delay before” value to allow time to the application to render entirely and become responsive at UiPath.UIAutomationNext.Activities.TargetCommonLogic.GetSearchResultAsync(IRuntimeContext runtimeContext, ITargetAnchorable target, CancellationToken token)
at UiPath.UIAutomationNext.Activities.NClick.UiPath.UIAutomationNext.Activities.IVerifyExecutionActivity.ExecuteAsync(IRuntimeContext context, IActivityData data, CancellationToken cancellationToken)
at UiPath.UIAutomationNext.Activities.Services.VerifyExecutionService.ExecuteWithVerifyAsync[T](IVerifyExecutionActivity activity, IVerifyExecutionRuntimeContext verifyContext, IRuntimeContext context, T data, CancellationToken token)
at UiPath.UIAutomationNext.Activities.NClick.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Shared.Activities.ContinuableAsyncCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
— End of stack trace from previous location —
at UiPath.UIAutomationNext.Activities.NApplicationCard.OnFault(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Hi @Primal

Did you give a retry number in the retry scope?

And please add at least one catch for the exception to be caught

cheers

Hi,

If we turn on LogActivites on RibbonMenu, studio output logs for all the activities, as the following.
There might be something to solve this matter.

Regards,

That was the trick. I didn’t have a retry set or intervals; also, I didn’t have an exception set. Thank you for helping me figure this out. I am still trying to learn the syntax of this program. This time it went into the retry scope and failed there as it was supposed to.

22.10.3+Branch.master.Sha.def2351dc828ccfbcddb6e9e07c9cf71b5bf55da

Source: Retry Scope (Retry Scope)

Message: I could not find the user-interface (UI) element for this action.

Possible solutions:
• Ensure application is opened and the UI element is visible on the screen at execution time
• Edit the Target of the UI activity and use Validation to debug the issue.
• If needed, re-indicate the element as its properties might have changed
• Use “Check state” activity to check the application state before executing the action
• Increase the “Delay before” value to allow time to the application to render entirely and become responsive

Exception Type: UiPath.UIAutomationNext.Exceptions.NodeNotFoundException

UiPath.UIAutomationNext.Exceptions.NodeNotFoundException: Could not find the user-interface (UI) element for this action.

Possible solutions:
• Ensure application is opened and the UI element is visible on the screen at execution time
• Edit the Target of the UI activity and use Validation to debug the issue.
• If needed, re-indicate the element as its properties might have changed
• Use “Check state” activity to check the application state before executing the action
• Increase the “Delay before” value to allow time to the application to render entirely and become responsive at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

2 Likes

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