Get Display Name of Activity within Try Catch mechanism

activities
studio
error
#1

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.

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.

#2

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
#3

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.

#4

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.

#5

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

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

Let me know if this helps!
Best,
Oriol

#6

Hi,

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

Cheers

1 Like
#7

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