How to print specific error

dear team,

I want to know, how can we print specific and up to the point error. let’s say file not found, it should give file not found , now it’s giving me a 3 page error, useless, if i maintain my seprate log file, it will waste so much space only for this error.

People who has AA idea know better.

In AA you have one simple $ErrorMessage$ variable that always gives you a clean, consistent description without the massive technical dump.

kindly suggest

2 Likes

@balkishan,

YourExceptionObject.Message should give the exact exception message without any suggestions or traces.

Put your error-prone code in try section and in catch section add log or logic to handle that scenario.

3 Likes

Could you please share a screenshot of your error message?

You can get the simpler form of error message by using exception.Message

1 Like

Hi @balkishan

You can use try-catch and inside catch, use “exception.message” to get specific error like “file not found” …

Happy Automation

2 Likes

Hi Thanks for the resply…
@ashokkarale @manasrlenka25 @prashant1603765

See, i don’t wan this much exception details…I know i have put the wrong file…but if you see the message it’s giving everything, which i really don’t only.

If you see this error message, can you identify there is wrong file attached…this system throwing error is totally irrelevant.

If you guys have worked in AA, you will know what i meant. AA giving specific error message…not like whole history.

@balkishan,

In that case you will have to check the error message and then throw or log custom error.

Check the exception.Message.Contains("document is malformed") then log "file not found..."

1 Like

This is like an extra work for each log message.

First, I need to check the type of error, then modify the message. I don’t think it makes any sense.

@balkishan,

Totally agree but the error message is not being generated by UiPath it’s being generated by BitMiracle activity you are using. Whatever tool or API you use for this, you will be getting similar error message. UiPath just reciving and showing it further.

I feel this error message is going to be helpful to the developer or support person to debug the code and anyway should be thrown as system exception. Getting these lengthy system exception is really helpful to debug the issue. If you want to send this to business or non technical person, custom BRE is what we should use.

1 Like

@balkishan
If we use Exception.Message(), it gives the description of the current exception.
To make it simpler, I tried Exception.GetType().Name, which gives the runtime type of the current error.

You can check the Exception Class link for more details: Exception Class (System) | Microsoft Learn

I’ve also attached a screenshot showing how I got the simpler exception.

Please mark it as the solution if it resolves your query.

1 Like

How can it know the wrong file is attached? It can’t. All it can know is that the format of the file you provided is invalid, which is the actual error.

3 Likes

@balkishan

I understand AA..there are few specific errors it gives ..not all as well

Here you can use exception.GetType will give you the type of exception if you want to know only that..message ideally needa to be clear as well..and to customize you can catch it can write any exception you need

The exceptions are derived from .net for full reference of types you can refer to same .net exceptions

For now try Exception.GetType

Also echoing what @postwick has said ..first its throwing type error as path is given before checking path the first check is done on extension as well

Cheers

1 Like

@balkishan Automation Anywhere runs on a JavaScript-based framework, while UiPath is built on the .NET framework. Because of this difference in their technologies, the error messages appear differently in both tools.

Please correct me, If I am wrong.

https://www.royalcyber.com/blogs/rpa/uipath-vs-automation-anywhere-comparison/?

1 Like

@Balkishan Please mark the response that clarified your Query as solution to close this conversation.
This will help us to stay engaged with more community questions.

Happy Automation :slightly_smiling_face:

1 Like

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