UNIT V
ERROR AND EXCEPTION HANDLING:
• Errors, Error handling approach,
• Try Catch, Retry Scope,
• Exception Handling,
• Common Exceptions and ways to handle them,
• Handing Run time Exceptions,
• Types of Exceptions,
• Global Exception Handler,
• Best Practice for Error Handling.
DEPLOYING AND MAINTAINING THE BOT:
• Overview of Orchestration Server,
• Orchestrator Functionalities,
• Orchestrator User Interface- Connecting a Robot to
Orchestrator,
• Deploy the Robot to Orchestrator.
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. This are often called bugs.
Error/Exception Handling Approach
Exception Handling mainly deals with handling errors with respect to various
activities in UiPath. The Error Handling activity offers four options:
•Try Catch activity :
Try Catch activity is used when you want to test something and handle the
exception accordingly. So, whatever you want to test you can put it under the try
section, and then if any exception occurs, then it can be handled using the catch
section.
Apart from the try-catch, we also have a Finally section that performs the
activities irrespective of whether an exception occurs or not.
Try Catch Activity
Try Block
All the possible activities that
can create or cause error
should be placed in this block.
Catch Block
The user can add multiple type
of catches in this block.
Finally Block
It is used for the actions to be
performed after the Try & Catch
blocks.
Step 1: Drag the Try-Catch activity.
Step 2: Drag a sample sequence or workflow inside it.
▪ Click on “Catches”
Step 3: ▪ Choose “System.Exception”
▪ Press Enter
Step 4: The user will get room for the actions in the Catches section.
Step 5: In the Catch block, add activities to take place when an error occurs
in the main workflow.
▪ Drag and drop the Log Message command inside the Catch block.
▪ Choose the level “Warn”.
▪ In the message column, write, “an error”+exception. Message.
Global Exception Handler
The Global Exception Handler is a type of workflow designed to
determine the project’s behavior when encountering an execution error.
• Only one Global Exception Handler can be set per automation
project.
• The Global Exception Handler has two arguments, that
should not be removed.
• The first argument is errorInfo with the In direction and it
stores information about the error that was thrown and the
workflow that failed. The level of the error to be logged can be
set in the Log Message activity.
Global Exception Handler
The second argument, result has the Out direction and it is used for determining
the next behavior of the process when it encounters an error.
The following values can be assigned to the result argument:
• Continue - The exception is re-thrown.
• Ignore - The exception is ignored, and the execution continues from the next
activity.
• Retry - The activity which threw the exception is retried. Use the RetryCount
method for errorInfo to count the number of times the activity is retried.
• Abort - The execution stops after running the current Global Exception
Handler.
https://docs.uipath.com/studio/docs/global-exception-handler
Example of Using the Global Exception
Handler
Creating the Workflow
Adding a Global Exception Handler
Example of Using the Global Exception
Handler
Best Practice for Error Handling
1. Organizing your project
2. Choose the right layout
3. Break up your workflow
4. Exception handling and logging
5. Readability
5. Cleanup
6. Naming conventions
Organizing your project
• Reliable — create solid, robust workflows that can handle errors.
• Efficient — create a structure that:
• Helps to short down development time.
• Helps to reduce errors in production.
• Maintainable — create a structure that makes it easy to update when
needed.
• Extendable — new requirements should be able to be implemented easily.
Choose the right layout
• The main workflow works best as a Flowchart or a State Machine.
• Business logic works best in Flowcharts as it is easier to visualize.
• Consider using ReFramework if you are using Orchestrator-queues.
• UI interactions work best as sequences as it does not involve much
logic.
• If one sees that there is a need for much if-else checks and the like, then
one should consider using a Flowchart.
• Avoid nested IF statements, use Flowcharts instead; It gives a tidier
flow.
Break up your workflow
• Keywords: Extract as Workflow.
• Makes it possible to develop and test the various parts separately.
• Allows you to reuse workflows.
• Makes it easier to cooperate in a team when working on different files (use
Invoke Workflow File).
• Easiest if you send pure string parameters and not lists and the like (is easier
to set default parameters on primitive types like string, int32, etc.).
Exception handling and logging
• Put problematic workflows in try/catch blocks.
• Implement sequences within the Try / Catch blocks that allow you to
restore the workflow.
• Use the Retry Scope for fragile(breakable) parts in the workflow.
Readability
• Give good, explanatory names to all components (workflows, activities,
variables, etc.).
• Enter notes and comments where necessary. Annotations are very useful.
• Log real-time execution.
Cleanup
• Close applications, windows and web pages. If you do not, many
interactions will have numerous instances of these running, which can
eventually crash the machine.
• Always try soft-close applications first if the killing process is not used
Naming conventions
• When creating very large automation, it can be very easy to forget what
every variable does. That is why it is important to have a good naming
system in place.
• It is recommend that always use descriptive and accurate names, such as
userName for a variable that stores the name of a user. This allows you to
easily identify the information the variable stores.
Project organization
While working on any automation project, it is very important to work with a proper set
of rules so that the project can be organized in an efficient way.
In UiPath, the following are some of the best practices considered while working
on a project:
• Pick an appropriate layout for each workflow
• Break the whole process into smaller parts
• Use exception handling
• Make your workflow readable
• Keep it clean
Project organization
Project organization
Project organization
Project organization
Project organization Making your workflow readable
When to use Flowcharts, State Machines, or
Sequences
When to use Flowcharts, State Machines, or
Sequences
Business Exception vs Application Exception
An Application Exception describes an error rooted in a technical issue, such as
an application that is not responding. Such a situation is, for example,
• a project which extracts phone numbers from an employee database, creating
queue items for each of them.
• These items are then to be processed and inserted into a financial application.
• If, when the transaction is attempted, the financial application freezes, the
Robot cannot find the field where it should insert the phone number, and
eventually throws an error.
Note: System exceptions are the one which happens due to issue in application
you are interacting with
A Business Exception describes an error rooted in the fact that certain data which
the automation project depends on is incomplete or missing. Such a situation is, for
example,
• a project which extracts phone numbers from an employee database, creating
queue items for each of them.
• These items are then to be processed and inserted into a financial application.
• If a certain phone number is missing a digit due to human error, the queue item
containing it becomes invalid.
• This causes the automation to throw an exception, as the Phone Number field in
the financial application does not accept a queue item that contains an
incomplete number.
Note: Business exceptions are the one which happens when some business rules are
not satisfied.
Retry Scope
• Retries the contained activities as long as the condition is not met or an
error is thrown.
Properties
Options
• NumberOfRetries - The number of times that the sequence is to be
retried.
• RetryInterval - Specifies the amount of time (in seconds) between
each retry.
Common
• DisplayName - The display name of the activity.
• ContinueOnError - Specifies if the automation should continue even
when the activity throws an error. This field only supports Boolean
values (True, False). The default value is False.
• As a result, if the field is blank and an error is thrown, the
execution of the project stops. If the value is set to True, the
execution of the project continues regardless of any error.
Retry Scope
•Rethrow : Rethrowing an exception If a catch block cannot handle the
particular exception it has caught, you can rethrow the exception. The rethrow
expression ( throw without assignment_expression) causes the originally thrown
object to be rethrown.
•Terminate workflow : Terminate workflow is used to terminate the workflow
the moment the task encounters an exception.
•Throw activity : Throw activity is used when you want to throw an exception.
Orchestrator
Orchestrator is the heart of your automation management. It gives you the
power to provision, deploy, trigger, monitor, measure, track, and ensure the
security of every robot
Orchestrator can be defined as a web application where people or end users
can deploy their robots, monitor the health of the robots, manage their
functioning and keep a log of tasks the robots
Orchestrator is a centralized application for deploying a robot, managing its
functionality, monitoring the tasks it is undertaking and logging the reports in
storage.
https://docs.uipath.com/orchestrator/
Orchestrator Main Capabilities
•Provisioning - creates and maintains the connection between Robots and the
web application
•Deployment - assures the correct delivery of package versions to the assigned
Robots for execution
•Configuration - maintains and delivers Robot environments and processes
configuration
Orchestrator Main Capabilities
•Queues - ensures automatic workload distribution across Robots
•Monitoring - keeps track of Robot identification data and maintains user
permissions
•Logging - stores and indexes the logs to an SQL database and/or Elasticsearch
(depending on your architecture and configuration)
•Inter-connectivity - acts as the centralized point of communication for 3rd party
solutions or applications
Logical/Functional components of
Orchestrator
• Processes: A process represents the association between a package and an
environment. Each time a package is linked to an environment, it is
automatically distributed to all the Robot machines that belong to that
environment.
• Assets: Assets usually represent shared variables or credentials that can be used
in different automation projects. They give you the opportunity to store specific
information so that the Robots can easily have access to it.
• Queues: A queue is a container that enables you to hold an unlimited number of
items. New queues created in Orchestrator are empty by default and can store
multiple types of data.
• Schedules: Schedules enable you to execute jobs in a pre-planned manner, at
regular intervals on Robots. Input values for processes which support input and
output parameters can be managed at this level as well
Logical components of Orchestrator
• Robots: A Robot is an execution host that runs processes built in UiPath
Studio. The Robots page enables you to add robots, edit them, view their
status and other settings.
• Jobs: A job is the execution of a process on one or multiple Robots. After
creating a process the next step is to execute it by creating a job. When
creating a new job, you can assign it to specific Robots.
• Transactions: The Transactions page displays the transactions from a
given queue. It also shows their statuses, the dates when they should be
processed, the Robot that processed them, and the type of exception
thrown or assigned reference, if any.
Advantages & Uses of UiPath Orchestrator
•Deployment: One can deploy their robots on this platform once they are created
and developed completely.
•Scheduling: One can schedule when and how the robot must run and what and
all should be logged.
•Management: If a developer deploys numerous number of robots on the portal,
the Orchestrator offers multiple features for the management of these robots.
•Maintenance: It is a very useful feature. Once developers have deployed their
robots, they can manage and maintain these robots using the Orchestrator.
•Monitoring: One can monitor the real-time run of the robots
using UiPath Orchestrator and see how the robot executes each process defined
by the developer.
https://www.educba.com/uipath-orchestrator/
Main advantages of UiPath Orchestrator
•Checks the Performance of the Robot: The concept of a robot’s heartbeat is
unique to the Orchestrator. Here the robots which are running fine or are in
good health, send constant heartbeats (or signals) to the central server. Once
the heartbeats become less frequent, the server is alerted for the declining
health of the robot and thereby alerts the developer/manager too.
•Common and Shared Assets: The robots are designed in such a way that
they need some resources to execute the tasks defined by the developers.
These resources are called assets. They are re-usable and stored within the
Orchestrator. They are provided to the robots whenever needed.
Main advantages of UiPath Orchestrator
•Exception is Handled Smartly: If there occurs any exception in the process
run of the robot, it doesn’t immediately send out a notification. the
Orchestrator makes the robot attempt the task one more time as a
precautionary check. If it functions properly in the second run, the schedule
remains as is. If it still encounters the exception, an alert is sent out to the
developer to check the issue.
•Choice Amongst Multiple Clouds: There are various choices for clouds
offered by the Orchestrator. It can be either on one’s personal cloud or the
cloud offered by the Orchestrator.
•Remote Monitoring: A developer can easily monitor the robots from
anywhere using their cell phones.
Robot Types
Attended Robots
Supervised Robots that run under human supervision. Can be further classified
according to their licensing type as follows:
•Attended - Works on the same workstation as a human user and is launched
through user events.
•Studio - Connects your Studio to Orchestrator for development purposes.
Robot Types
Unattended Robots
Autonomous Robots that don't require human supervision to execute jobs. Can
be further classified according to their licensing type as follows:
•Unattended - Runs without human supervision in virtual environments and can
automate any number of processes.
• Has all the capabilities of an attended robot plus remote execution,
monitoring, scheduling, and support for work queues. Can execute any
process type except for test cases.
Connect a Robot to Orchestrator
Step 01: Log in to Orchestrator & navigate to Services
Step 02: Create a new machine
Step 03: Name the machine as per the Orchestrator Settings of
the robot
Step 04: Navigate to Robots and add a Standard Robot
Step 05: In Orchestrator settings, add Orchestrator URL &
machine key
Publish a Robot to Orchestrator
Step 01: Open a robot in UiPath Studio.
Step 02:Click on Publish in Design ribbon
Step 03: Write a description of changes made in the
project in Release Notes section
Deploying and Maintaining the Bot
How to publish a workflow in UiPath
Overview of Orchestration Server
Using of Robots was not as popular as it is now. In other words, we can say that
Robots worked within a limited environment. But today, due to Robotic Process
Automation (RPA), Robots can work in different environments.
• Nowadays, their performance is not limited. They are now playing a big role in
terms of automation, working as assistant bots to fully potential Robots.
• They can work 24/7 and their operations can be managed and scheduled
through the Orchestrator Server.
• UiPath Orchestrator is a web server that provides you with an
environment for maintaining and scheduling your bots.
• Orchestrator is a highly accessible web server platform for fast deployment
from one Robot to many Robots.
Overview of Orchestration Server
Overview of Orchestration Server
Overview of Orchestration Server
Overview of Orchestration Server
Deploying a process
Using Orchestration Server to deploy bots
Using Orchestration Server to deploy bots
Connecting a Robot to Orchestrator
Deploy the Robot to Orchestrator
Deploy the Robot to Orchestrator
Deploy the Robot to Orchestrator