Exception Handling
Exception Handling
Exception Handling
Exception Handling - Agenda
● Output Methods
★ Best Practices
Exception Handling Situations
Addressing Exceptions in development
Activities to be covered
with exception handling
Exception Types to be
handled:
Activities that will be ● Exception Type
executed no matter what ● Response Activity
Exception Handling Activities
Rethrow - When a workflow invokes another workflow that has an exception,
rethrow will throw the exception from the inner one to be handled in the main one
Thrown when a variable has not been initialized (has no value). Make sure the variable has a value before using a
method on it.
Index was outside the bounds of the array. Index out of range.
Thrown in an attempt to access array or collection elements with an index that is outside its capacity, e.g. getting
an element of a list without checking if the list contains items
Occurs when the selector used to identify the element does not match any element on the screen. To debug, you
need to inspect the target application and observe if the element exists.
Common Exceptions
Image was not found in the provided timeout.
Occurs when an image is can’t be identified because it is: not visible in foreground, the image resolution is
slightly different due to environment settings or elements are in different state.
Occurs in text-based automation activities. Text needs to be on the screen when the activity is reached.
Click generic error. Cannot use UI_CONTROL_API on this UI node. Please use
UI_HARDWARE_EVENTS method.
Occurs when a click could not be executed. Happens when using SimulateClick or SendWindowMessages options
in an application window that does not support them.
Automation Challenges
Timing Issues:
Unexpected behavior is likely to occur when the application is not in the state the
workflow assumes it to be.
Watch for is the time the application takes to respond to workflow Interactions using the
TimeoutMS and WaitForReady properties.
A delay activity can be used to delay the next activity if it should not be executed
immediately.
Automation Challenges
Input Method Issues:
Each input method has its own particularities and can trigger a different behavior to the
target application.
Coordinates Issues:
Coordinates are relative to the target but it’s recommended to use them as little as
possible in situation where the layout of the application changes between instances.
Extra measures may be needed to maintain the layout of the application.
UI Synchronization
Useful activities for checking application UI status
This allows the user to track the workflow variables and path as it is being executed
Breakpoints can be toggled on activities to stop the debug execution when it reaches them
Output Panel
Log messages with process feedback can be written throughout the workflow so they can be reviewed in the
output panel afterwards
Best Practices
Use LogMessage to trace execution status
While looping
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.
1. errorinfo : The first argument is errorInfo with the In direction and it stores information
about the error that was thrown and the workflow that failed.
2. Result : The second argument, result has the Out direction and it is used for
determining the next behaviour of the process when it encounters an error.
Ignore - The exception is ignored, and the execution continues from the next
activity.