Debugging and Exception Handling
Handling exceptions
UiPath uses .NET exceptions. Structure error-prone logic with Try Catch Finally: Catch specific types first, log context, and only swallow an exception when continuing is genuinely safe. Throw raises a new exception; Rethrow preserves the original stack trace inside a Catch. Use BusinessRuleException for rule violations (missing data, invalid invoice) because the REFramework will not retry those, and generic exceptions for technical failures where a retry may help. Retry Scope wraps an action and optionally a condition, retrying a configurable number of times with an interval. Global Exception Handler catches unhandled errors at process level but does not replace Try Catch.
Debugging tools
Breakpoints, Step Into / Step Over / Step Out, Run to Cursor, Slow Step, and the Locals, Watch, Immediate and Call Stack panels. Logging levels are Trace, Info, Warn, Error and Fatal; Add Log Fields attaches context such as a transaction reference to every subsequent log entry.
Traps
- Catching System.Exception everywhere and continuing, hiding real failures.
- Forgetting to close applications in Finally, leaving orphaned processes.
- Expecting Retry Scope to fix a business rule failure.
- Believing Try Catch handles compile-time or selector-validation errors in the designer.
Rule of thumb
Catch the narrowest type that makes sense, log what you know (transaction id, selector, file path), and rethrow anything you cannot actually resolve.