Throw error
Fails on purpose with a message, so the step's failure handling takes over.
Throw error message
Keyboard Maestro: Throw
Details #
Makes the step fail with your message. What happens next is up to the step's own failure setting: stop ends the macro with that message, continue carries on, and branch runs the step's onFailureSteps. With branch, the message is stored in the error variable (and the step's path in errorStep) before the onFailureSteps run.
Put it inside an If to turn a check into a clear error, such as "no file was chosen".
If you give no message, the failure reads "Exception thrown".
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
message | text | The failure text. Can use variables and expressions. | ||
text | text | Another spelling of message. Used when message is missing. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Throw “The report folder is missing”
Gotchas #
In a dry run the step is simulated, so it does not fail unless it is marked
dryRunSafe.With the default
stop, the macro ends here and the message is what you see as the reason.