Exception Location

I use a try catch to capture the exception of my flowchart, but how can I locate the error activity when error was caught? Any solutions for this? thanks

@rudy,

Exception.Message gives you the Message of the Exception
Exception.Source gives you activity where exception happened

References:

  1. How to Capture an Exception - #2 by ClaytonM
  2. Try Catch Printing Exception Source - #5 by badita
  3. Many More…

Regards,
Dominic :slight_smile:

2 Likes

Thanks Dominic,
I tried the solution you given, but actually it did not show the display name of activity, just “UiPath.Core.Activities” given. any suggestion for this ? thanks.

@rudy, Can you share screenhsots ? Actually it should.

Regards,
Dominic :slight_smile:

Dominic, as you seen on the screen shot. actually the second activity will lead to error because I did not give a correct selector, but the debug result do not show its display name at all.

@rudy, Sorry there is catch here,

Reference : Try Catch Printing Exception Source - #5 by badita

Regards,
Dominic :slight_smile:

Dominic, I think this is not so a good design, base on this, I have to create at least two workflows, even I just want to create a very simple robot. Many thanks for your comments.

Hi @rudy,

if you get exception in try block you cant get the activity name, so use only on try catch block for entire project(in main/starting xaml alone use the try catch block)

In main/starting xaml alone use try catch block inside you call another xaml file invoke other xaml file.(so the entire project only one try catch block need to use so only you can get the activity name.

Regards,
Arivu

@rudy, you needn’t to use two workflows. Point here is If you use Try catch with Invoke Workflow activity then you can catch the activity name with exception.Source

Regards,
Dominic :slight_smile:

Hi Arivu, now I have a project which have to download information from multiple business systems. For each system, I want to create a xaml file so that I can get the result via out-arguments, and if failed in downloading, the robot need to write the running log. but exception may be given from any xaml files, if I want the robot to write the log correctly, it is difficult to get all the exception data from main xaml file.

Hi @rudy,

So you can create another main xaml file for download your file,invoke there another xaml file, in try Exception get the error message and store it in out-arguments and get you can track it.

Regards,
Arivu