- Release Notes
- Getting Started
- Setup and Configuration
- Automation Projects
- Dependencies
- Types of Workflows
- Sequences
- Flowcharts
- State Machines
- Global Exception Handler
- Workflow From a Template
- Forms
- File Comparison
- Automation Best Practices
- Source Control Integration
- Debugging
- The Diagnostic Tool
- Variables
- Arguments
- Imported Namespaces
- Trigger-based Attended Automation
- Recording
- UI Elements
- Control Flow
- Selectors
- Object Repository
- Data Scraping
- Image and Text Automation
- Citrix Technologies Automation
- RDP Automation
- Salesforce Automation
- SAP Automation
- VMware Horizon Automation
- Logging
- The ScreenScrapeJavaSupport Tool
- The WebDriver Protocol
- Test Suite - Studio
- Extensions
- Troubleshooting
- About troubleshooting
- Microsoft App-V support and limitations
- Internet Explorer X64 troubleshooting
- Microsoft Office issues
- Identifying UI elements in PDF with Accessibility options
- Repairing Active Accessibility support
- Automating Applications Running Under a Different Windows User
- Validation of large Windows-legacy projects takes longer than expected
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.
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.
ActivityInfo
property for errorInfo
to get the name of the activity which threw the exception and view it in the Output panel.
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 forerrorInfo
to count the number of times the activity is retried. -
Abort - The execution stops after running the current Global Exception Handler.
Note: Any workflow may be flagged as a Global Exception Handler in Studio, except for library projects andMain.xaml
.
To control the workflow’s behavior in case of an error, the Global Exception Handler retries the activity three times and then aborts with an error message.
When an exception is detected during debugging, the activity which faulted is highlighted, the execution is paused, and the exception's type and details are mentioned in the Locals and Call Stack panels.
Debugging actions like Continue, Stop, Retry, Ignore, Restart and Slow Step are available in the ribbon. Ignore is used for continuing the execution from the next activity.
result
argument, either Continue, Ignore, Retry or Abort.
When using the Global Exception Handler with a project that includes a Try Catch, make sure to group activities into a Sequence inside the Try container. Otherwise, the Global Exception Handler does not execute.
In the case of nested activities, the Global Exception Handler executes for each activity in the call stack. However, it does not execute for activities directly encapsulated in a Try Catch, unless they're contained in an activity.
The following example showcases the project’s behavior when an exception is thrown during execution.
The automation project is set to type some text in a TXT file and then close the application, but not before saving the file.
When the Global Exception Handler encounters an exception, it logs the name of the activity which faulted and starts retrying the activity three times. If it encounters the same exception each time and the number of retries reaches 3, the execution is aborted at the level of the activity which threw the exception.
If during one of the retries an exception isn’t encountered, the execution of the workflow continues and the Global Exception Handler doesn’t step in.