Skip to content
23K
Console

Fail

The Fail state is internally used by the StepFunctions component to add a Fail workflow state to a state machine.

You’ll find this component returned by the fail method of the StepFunctions component.


Constructor

new Fail(args)

Parameters

FailArgs

assign?

Type Record<string, any>

Used to store variables. The Assign field accepts a JSON object with key/value pairs that define variable names and their assigned values. Alternatively, you can pass in a JSONata expression directly.

For more information, see Passing data between states with variables.

Provide a JSON object with variable names and values.

{
assign: {
productName: "product1",
count: 42,
available: true,
}
}

Assign values from state input and result using JSONata expressions.

{
assign: {
product: "{% $states.input.order.product %}",
currentPrice: "{% $states.result.Payload.current_price %}"
}
}

cause?

Type Input<string>

A custom string that describes the cause of the error. Alternatively, you can specify a JSONata expression that evaluates to a string.

comment?

Type Input<string>

A comment to describe the state.

error?

Type Input<string>

An error name that you can provide to perform error handling using retry or catch. Alternatively, you can specify a JSONata expression that evaluates to a string.

name

Type string

The name of the state.

output?

Type Input<Record<string, any> | {% ${string} %}>

Specify and transform output from the state. When specified, the value overrides the state output default.

The output field accepts any JSON value (object, array, string, number, boolean, null). Alternatively, you can pass in a JSONata expression directly.

For more information, see Transforming data with JSONata in Step Functions.