#uipathlearner #uipathtutorial #uipathcommunity #uipathtraining #uipathrpa
Error and Exception Handling in Uipath Studio
Identifying exceptions and differentiating types of exceptions
How to use TryCatch, Throw, and Rethrow activities in your automation projects.
Functionality of Retry Scope Activity
Usage of ContinueOnError Property
Use the Global Exception Handler in both attended and unattended scenarios.
TryCatch,
Throw,
Rethrow,
Retry Scope,
ContinueOnError
and Global Exception Handler
1. Identifying exceptions and differentiating types of exceptions
Errors :
Errors are events that a particular program can’t normally deal with. There are different types of errors, based on what's causing them - for example:
Syntax errors, where the compiler/interpreter cannot parse the written code into meaningful computer instructions.
User errors, where the software determines that the user’s input is not acceptable for some reason.
Programming errors, where the program contains no syntax errors but does not produce the expected results. These types of errors are often called bugs.
Exceptions :
Exceptions are events that are recognized (caught) by the program, categorized, and handled. More specifically, there is a routine configured by the developer that is activated when an exception is caught. Sometimes, the handling mechanism can be simply stopping the execution.
Some of the exceptions are linked to the systems used, while others are linked to the logic of the business process.
System exceptions :
System exception can occur due to the unavailability of the item which you declared in your process, and it can occur at any point of time. For example: – A project where a URL need to open in browser and that URL is not responding, in such cases you will encounter an exception which will cover under system exception.
System Exception and Application Exception are similar. Only difference is Application Exception describes an error rooted in a technical issue, such as an application that is not responding. Whereas System Exception is thrown by the common language runtime when errors occur that are nonfatal and recoverable by user programs. You can perform a multiple retry on this exception and if after that it is not recovered you can notify operation team.
Syntax of creating System exception.
New System.Exception(“User Custom Message”)
Most Common System Exception which you will face in UiPath are below: –
• NullReferenceException - Occurs when using a variable with no set value (not initialized).
• IndexOutOfRangeException - Occurs when the index of an object is out of the limits of the collection.
• ArgumentException - Is thrown when a method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method.
• SelectorNotFoundException - Is thrown when the robot is unable to find the designated selector for an activity in the target app within the TimeOut period.
• ImageOperationException - Occurs when an image is not found within the TimeOut period.
• TextNotFoundException - Occurs when the indicated text is not found within the TimeOut period.
• ApplicationException - Describes an error rooted in a technical issue, such as an application that is not responding.
Business Exception:
A Business exception describes an error rooted in certain data which the automation project depends on, is incomplete or missing. Such a situation is, for example, a project which read column data from excel sheet provided by the business and that column is missing in the provided file.
We also call business exception as a user defined exception when we apply business rule to our project and if the condition is not satisfied in such situation, we must declare business exception into the code. Retrying the transaction does not yield any chance of solving the issue, and there are other better courses of action, such as notifying the human user of this error.
Another good example of business exception scenario is when you are login into the application and the credentials is changed from the backend in such case bot will try to login and throw a business exception stated Invalid username password.
Syntax of creating business exception.
New BusinessRuleException (“Custom Message”)