simulate.error
The simulate.error: command is used inside an on_simulate: event handler to provide mock error output and trigger the enclosing command's on_error: event during simulation.
start:
http.request:
output: http_response
inputs:
method: GET
url: https://api.example/
on_simulate:
simulate.error:
error: Connection timed out
on_success:
return:
body@key: http_response:body
on_error:
return:
error@key: http_response:errorSyntax
output keys:
The optional key/value pairs provided to simulate.error: are merged into the output: placeholder of the enclosing command, exactly as if the command had run and failed. Typically this includes an error: key with a message string.
on_simulate:
simulate.error: is itself only valid inside an on_simulate: event handler. It cannot be used outside of simulation context.
on_success:
Not applicable. simulate.error: always triggers the on_error: path. Use simulate.success: to trigger the on_success: path instead.
on_error:
After simulate.error: runs, the enclosing command's on_error: event is executed with the simulated error output available in the output: placeholder.
If the enclosing command has no on_error: handler, the automation exits in the error state.
See also
- Simulation — overview of how simulation works in automations
- simulate.success: — simulate a successful command outcome