(params: {
throw?: boolean,
message?: string,
metaData?: any
}): voidThe 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 whentrueor continues the action chain whenfalseor 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: throw
type: Throw
params:
throw:
_eq:
- _state: lukes_father
- Darth Vader
message: NoooooooooooooooooThrow with metaData:
- id: throw
type: Throw
params:
throw:
_eq:
- _state: lukes_father
- Darth Vader
message: Nooooooooooooooooo
metaData:
realisation: Luke kissed his sisterOverride custom message:
- id: throw
type: Throw
messages:
error: Meh.
params:
throw:
_eq:
- _state: lukes_father
- Darth Vader
message: NoooooooooooooooooFail silently:
- id: throw
type: Throw
messages:
error: false
params:
throw:
_eq:
- _state: lukes_father
- Darth Vader
message: Nooooooooooooooooo