How to get Error Message on GlobalHandler

How do I get the Error Message in GlobalHandler, like how you use “Exception.Message” in Try Cathc?

@Shinjid

It has one argument called in_ErrorInfo. It holds the exception message. You can print the below value in Log Message activity to display the error.

      in_ErrorInfo.Exception.ToString

Global Handler
Is there a way to make the message shorter?

@Shinjid

Let’s say you want to read first 50 characters from the exception message then you can try below expression.

        in_ErrorInfo.Exception.ToString.Substring(0,50)

@Shinjid

If you want to just the see Activity name which throws the exception then try below expression.

           in_ErrorInfo.ActivityInfo.ToString
1 Like

I found it. I’m not sure if this works in other version. But this one

errorInfo.Exception.Message

Also works in Global Handler. I was using a lower version of UiPath when I was trying to, so I tried it on a newer version.

The message helps too, but it only shows which activity gave an error.

@Shinjid

Yes it will display error Activity name only.

If you want shorter message then you need use Substring method in error message as I mentioned in my earlier post.

The first one works too. It just that. I want to get the message like how we get it using try catch. Using ErrorInfo.Exception.Message on a higher version of UiPath worked on mine.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.