Get Display Name of Activity within Try Catch mechanism

Hello everyone, I hope someone can help me with the following.

I’ve got a a large number of mouseclicks and keyboard actions within a Try Catch block. I’m doing this because I know the application the robot interacts with sometimes is unresponsive or a button might change. Currently, I can get things like the exception.Source and exception.Message when an error occurs. I let the robot send this information in an e-mail to myself and colleagues. However, what I would really like to be able is to get the Display Name of the Activity itself where the error occured. This is because I have a lot of activities and I would like to pinpoint exactly which one faulted. The info I’m currently getting leaves me guessing which one it is (the activities are similar, but not the same).

Now I’ve seen other forum posts that touch this issue. For example: Activity display name in Try-catch, TryCatch - Get activity: "DisplayName", Obtain Sequence's DisplayName - #5 by xxx_oioi.

Some of them seem to be saying that it’s impossible to get the Display Name. However, I have made an example workflow that shows that this information is at least available in the standard output of UIPath Studio. Still I can’t seem to get this info in a variable or Message Box (and ultimately let the robot send this info to myself via e-mail). See the attached two workflow files. When you run the Main, the invoked Click workflow will run into an error. Now you can see in the screenshot below that the Display Name of the activity is in the standard output, but I can’t seem to retrieve it via the exception handling.

Main.xaml (6.8 KB)

Click.xaml (5.1 KB)

Is someone able to get the Display Name of the Activity - in this case “Click on Button X” - shown in the Message Box for me? I can pick things up from there.

Hi @ColinOtto,

For this, in the Catch section you would need to specify the following: exception.Source which will give you the name of the activity. You can also use exception.Message to get the specific error message.

Best,
Oriol

1 Like

So I’ve just seen that you are actually using these methods but not getting the expected results.
I tested your files and I get the correct activity name.
image

Maybe it’s something related to the version you are using.

Hey oriolsolani, thank you for time and effort!

Wow, that’s weird I must say. Indeed in your case the exception.Source actually gives what I want. That’s amazing, and exactly what I want :slight_smile:

However that indeed begs the question how this is possible. Perhaps indeed a versioning issue. I’m currently running on UiPath Studio 2018.3.3 Enterprise Edition. Which version are you using?

The other thing I can imagine, is that it’s a setting. But I don’t yet see anything like that in the Studio.

Hey!
No worries :slight_smile:

I’m using UiPath 2018.4.3, however I do not think this is an issue with your version.

I checked in the forum and I’ve seen a couple of questions with regards to the same issue, please check the forum before creating a new question as you may find the solution in there :slight_smile:

Check the answer marked as “Solution” as it could solve your issue: Try Catch Printing Exception Source - #4 by vvaidya

There is also this article but I haven’t seen any solution in there: How to get Exception source "Activity Description name" - #2 by aksh1yadav

Let me know if this helps!
Best,
Oriol

Hi,

This is indeed a version issue.
See the topic bellow for Reference.

Cheers

2 Likes

Thank you Florent, then I will divert my efforts to updating the version I’m currently using!

Hi @oriolsolani,
Am using the version 2019.10.4 community and i still have the same issue.

I need the message from Log event in output box.