Customized logs

Hi,
Can anyone explain how to generate customized logs in uipath for the activities that throw error. Like is it possible to create csv log file or any other format for particularly those activities that throw exception? If so is it possible to include the activity names that failed in the customized log file? Also how to correct unhandled exception that occurs randomly? Is there any way to include all types of exception in a single exception?

I want to prepend this by saying that this is much easier if you’re using the REFramework, so my explanation will be based on that.

  1. You can create a log file for errors. A datatable can be created where a row can be added for each exception. Define the table with whatever fields you want to include. The exception is stored in the exception variable in the Catch block for the exception given.

  2. To get the activity name, you can use exception.Source.

  3. Correcting unhandled exceptions that occur randomly depends on the exception. There is no method for correcting all unknown exceptions. You’ll have to define the logic yourself.

  4. If you’re using the REFramework, BusinessRuleExceptions are separated from all other exceptions, but outside of that, all exceptions can be caught if your Catch block is looking for System.Exception with no further specificity.

1 Like

Hi Anthony,
Thank you for your reply. As you said, all exceptions can be caught if your catch block is looking for System.Exception, I am not able to catch FormatException just by adding System.Exception in the catch block coz it still pops up the error message. I have to add System.FormatException in the catch block to fix this. Am I missing anything here?

If you’re running the code in Debug mode, you will still see errors. If you continue through them, you’ll reach the Catch block.

Okay thank you Anthony :slightly_smiling_face: