Browse the docs

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 #

ParameterTypeRequiredValuesWhat it does
messagetextThe failure text. Can use variables and expressions.
texttextAnother spelling of message. Used when message is missing.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Fail on purpose and show the message
Do
  1. Throw “The report folder is missing”
Open in Switchboard to try it

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.

See also #

Log message, Stop macro, If