- Before this lesson
- Breakpoints and debugging
- You will learn to
- Put steps into Try and recovery steps into Catch
- Choose continue, retry or stop
- Save the error message to a variable
- Know when not to catch
- Sample files
- error-handling.station.json
How Try/Catch works
Try/Catch runs the steps in Try. If one fails, Station runs the steps in Catch, then follows On Error:
| On Error | After Catch |
|---|---|
| continue | carry on with the step after Try/Catch |
| retry | run Try again, up to Max Retries times (default 3), then stop with the error |
| stop | stop the workflow with the original error |
Save Error To stores the error message in a variable for your Catch steps.
The sample
error-handling.station.json tries to read a file that does not exist, logs a clear warning with the error message, uses a safe default and continues.
Continue if this step fails
Every step's Properties also have Continue if this step fails. Use it for genuinely optional steps (closing a dialog that may not appear). For anything that matters, Try/Catch is clearer because it can log and react.
Good practice
- Catch specific, expected problems. Do not wrap the whole workflow in one Try/Catch that hides every failure.
- Retry only things that can succeed on a second attempt (a slow network), never a wrong click.
- Always say what happened in Catch: a log line, a file entry or a message.
Activities in this lesson
Try/Catch · Read File · Log · Set Variable
Saved only in this browser.
Workflow engine-tested. The sample workflow was executed with the macOS Station engine (StationCore) without the user interface. UI steps are source-verified. Written against RPAi Station for macOS 0.1.0 (1) (RPAi_Station_2.0 @ port/macos 9864e96) and the Windows source (RPAi_Station_2.0 @ codex/native-station e68f16d). Reviewed 2026-11-30. UI labels may differ slightly in other versions; see versions and changes.