(params: {
throw?: boolean,
message?: string,
metaData?: any
}): void
The Throw
action is used throw an error to the user and log to the console. If throw: true
, the Throw
action will throw an error, and this will stop the execution of actions that are defined after it. If the action does not thrown, the Throw
action will do nothing and the actions defined after it will be executed.
Parameters
throw: boolean
: Throws an error and stops the action chain whentrue
or continues the action chain whenfalse
or undefined.message: string
: The error message to show to the user and log to the console ifthrow: true
. This message can be overridden by setting the action'smessages.error
.metaData: any
: Data to log to the console ifthrow: true
.
Examples
Throw with custom message:
- id: foo_throw type: Throw params: throw: _eq: - _state: lukes_father - Darth Vader message: Nooooooooooooooooo
Throw with metaData:
- id: foo_throw type: Throw params: throw: _eq: - _state: lukes_father - Darth Vader message: Nooooooooooooooooo metaData: realisation: Luke kissed his sister
Override custom message:
- id: foo_throw type: Throw messages: error: Meh. params: throw: _eq: - _state: lukes_father - Darth Vader message: Nooooooooooooooooo
Fail silently:
- id: foo_throw type: Throw messages: error: false params: throw: _eq: - _state: lukes_father - Darth Vader message: Nooooooooooooooooo