How does the behavior of the Global Exception Handler (GEH) differ when a project contains Try Catch blocks?
When dealing with exceptions in UiPath projects that include Try Catch blocks, it is important to understand how the Global Exception Handler (GEH) behaves in different scenarios. The behavior of the GEH can be affected by the placement of activities within Try Catch constructs, and this article aims to clarify those behaviors.
Exception Handling Within Try Catch Blocks
In a Try Catch construct, the behavior of the GEH varies based on the placement of activities and the nesting levels within the Try Catch structure:
- Activity Directly within Try Container:
- If an activity, such as a Throw activity, resides directly within the Try container of a Try Catch block (without being enclosed in a surrounding Sequence), any exception thrown by that activity will be caught by the corresponding Catch handler.
- Nested Activities within Try Container:
- If an activity, such as a Throw activity, is nested within another container (e.g., a Sequence) within the Try container of a Try Catch block, the thrown exception will be caught by the Global Exception Handler (GEH).
This distinction is important to understand as it affects the flow of exception handling within the automation project.
Technical Limitation and Documentation
The behavior described above is considered a technical limitation and is documented in the UiPath Studio documentation under the section Handling Errors During Debugging.