I want to check a condition if the Window/Browser is existing or not in If Condition , but i could not find the window/browser type variable.
I also want to know, what if i have to print the line no, let’s say the error is on activity 10th line, while any error i want to print line no. Line Automation Anywhere & Power Automate.
what if my task/process bot is big, and having multiple activities, it could be mixed, same, different, lets say error occur in open excel , and open excel i have used multiple times in the workflow, then how will you know which open excel gave the error, if we can not print the error line number?
you can use check app state or element exists activities instead of using If activity.
Use Try catch activity and build your entire logic in try and in catch section you can use log message to print the error details like exception.source and message.
UiPath can not print the activity number, so you cant get the at which activity it getting failed but you can at what activity it getting failed. for that As UiPath best practice you need to give unique name for each activity while developing so that you can at what activity it getting failed.
remember you have to proivde the unique name for each actitvity based on what action it performing
We need to make the logs before and after of every critical steps,We need to maintain log messages for every activity to identify at which activity we got error.
And also we need to rename the activity and maintain exceptions
You need to select System.exception. This can handle almost all types of application exceptions.
Or if you want to throw your own excpetion nothing but any input data missing then you can select the business exception but when you want to use this business exception you need to throw the exception in try block by uisng Throw activity.
Hope this will clarify your doubts.
Please mark it as solution if you find this helpful.
Happy Automation.
If you see, i interntioanlly gave the wrong file path to see how UiPath behave while encounter any Error.
In the Exception Type: System.Exception selected.
I gave the sequence name is Test Error , and i printed the error in the message box, it gave me so many details (I feel which doesn’t require only). The error is file path is not found, first line make sense., i don’t see my sequence name there. how will i know which seq in the workflow cause the error, if multiple open excel are there.,.
I have printed the Exception.Source, why it is priting UiPath Platform
I have printed both what you mentioned in the post. see what i got in the message box.
One more thing i want to know, let’s say you’re using Throw then only it is giving the details, using Throw in the Catch Block will prevent to continue you’re workflow.
I want to avoid using Throw and get the exception details in Logs/Message, and want to continue to run the workflow.
Whatever actions you built create that as separate workflow
in Main take Try catch in try call that workflow using invoke workflow activity.
In catch section use log message in that pass "Source: " + exception.Source + Environment.NewLine + "Message: " + exception.Message
Now you can the exact error occured activity name and exact message..
Take a look below screenshots for your reference,
seprate Workflow that i created,