AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

Fail

Define a Fail state in the state machine. Reaching a Fail state terminates the state execution in failure.

Import

import { Fail } from 'aws-cdk-lib/aws-stepfunctions';

Or use the module namespace:

import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions';
// stepfunctions.Fail

Properties

Configuration passed to the constructor as FailProps.

causeOptional
string

A description for the cause of the failure.

Default: - No description

causePathOptional
string

JsonPath expression to select part of the state to be the cause to this state. You can also use an intrinsic function that returns a string to specify this property. The allowed functions include States.Format, States.JsonToString, States.ArrayGetItem, States.Base64Encode, States.Base64Decode, States.Hash, and States.UUID.

Default: - No cause path

errorOptional
string

Error code used to represent this failure.

Default: - No error code

errorPathOptional
string

JsonPath expression to select part of the state to be the error to this state. You can also use an intrinsic function that returns a string to specify this property. The allowed functions include States.Format, States.JsonToString, States.ArrayGetItem, States.Base64Encode, States.Base64Decode, States.Hash, and States.UUID.

Default: - No error path

3 properties inherited from StateBaseProps
commentOptionalinherited from StateBaseProps
string

A comment describing this state.

Default: No comment

queryLanguageOptionalinherited from StateBaseProps
QueryLanguage

The name of the query language used by the state. If the state does not contain a `queryLanguage` field, then it will use the query language specified in the top-level `queryLanguage` field.

Default: - JSONPath

stateNameOptionalinherited from StateBaseProps
string

Optional name for this state.

Default: - The construct ID will be used as state name

Get the AWS Step Functions Cheat Sheet

Everything you need to know about AWS Step Functions on one page. HD quality, print-friendly.

Download Free Infographic