How to get a display name of activity that gave error using try catch

I want to get the text "Write line ‘Number’ " for show using message box.

Hello,

Wrap your Activity inside a Workflow and use Invoke Workflow on Main, Then surround Main with a TryCatch.

Inside the Workflow you created, either do not surround it with a TryCatch or use Rethrow (not Throw because the Source would then be the Throw activity).

If your an exception occur in a Workflow itself invoked by another workflow (ex Main->Workflow1->Workflow2(ex), The sourrce of the exception would start to show you the Path the excecution took like under

`Invoke Workflow1 workflow: Activity Name

I havent found so far better way to refer to exact activity name using the exception object, of course you could hard-code on each worflow but i that would not a very scalable solution.

Hope it helps you.

You can also Refer to Badita post and example

Cheers

1 Like

The exception you catch there doesn’t store this information, the reason you can see it on unhandled exceptions is that the UiPath framework catches those for you and throws a new exception with additional context.

However, when you run the workflow in Debug mode, you will still be able to see in the output (and log files) the name of the particular activity that faulted first; so in your case the debug output will read something like

Try catch Executing
Write line ‘Number’ faulted
Sequence Executing
Message box Executing

The log file will additionally list some information about the names and values of variables at each point in the execution. So if you are just looking for debugging information, use this avenue and make sure to record the particular exception’s details (exception.Message) in the log or in the Transaction Error details if using the Orchestrator.

Hi,
However It just catches " Displayname" of the activity not the actual name of the activity.

sourceActivity

Yep that was what i meant, as the OP asked for.

Cheers

That works! Thanks for helping.

Hello

I am passing excetion argument to another Error xaml(this xaml will send the error mail with exception details) , but there i am not getting the source details. like one xaml gives the error in a particular activity then error exception mail should conatins the name of that xaml along with activity name.

when i am calling the error xaml from the catch block itself its giving the Proper name of the source : Xaml Name : Activity name.

but when i am passing the exception to error xaml , its not working like that.

Could you please help.

1 Like

Hi @Suchi3190,

Can you check the In/Out Arguments from the invoke workflow xaml file.
whether are you passing correctly

Regards,
Arivu

1 Like

Can anyone suggest?

1 Like