UNPKG

@wmfs/statebox

Version:

Orchestrate Node functions using Amazon States Language

27 lines (23 loc) 769 B
'use strict' const BaseStateType = require('./Base-state') const debugPackage = require('debug')('statebox') class Fail extends BaseStateType { constructor (stateName, stateMachine, stateDefinition, options) { super(stateName, stateMachine, stateDefinition, options) this.stateType = 'Fail' this.cause = stateDefinition.Cause this.error = stateDefinition.Error this.debug() } process (executionDescription) { debugPackage(`Encountered fail state '${this.name}' in stateMachine '${this.stateMachineName}' (executionName='${executionDescription.executionName}')`) this.processTaskFailure( { cause: this.cause, error: this.error }, executionDescription.executionName ) } } module.exports = Fail