Class Errors
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.stepfunctions.Errors
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:49.405Z")
@Stability(Stable)
public class Errors
extends software.amazon.jsii.JsiiObject
Predefined error strings Error names in Amazon States Language - https://states-language.net/spec.html#appendix-a Error handling in Step Functions - https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html.
Example:
import software.amazon.awscdk.services.dynamodb.*;
// create a table
Table table = Table.Builder.create(this, "montable")
.partitionKey(Attribute.builder()
.name("id")
.type(AttributeType.STRING)
.build())
.build();
Pass finalStatus = new Pass(this, "final step");
// States language JSON to put an item into DynamoDB
// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
Map<String, Object> stateJson = Map.of(
"Type", "Task",
"Resource", "arn:aws:states:::dynamodb:putItem",
"Parameters", Map.of(
"TableName", table.getTableName(),
"Item", Map.of(
"id", Map.of(
"S", "MyEntry"))),
"ResultPath", null);
// custom state which represents a task to insert data into DynamoDB
CustomState custom = CustomState.Builder.create(this, "my custom task")
.stateJson(stateJson)
.build();
// catch errors with addCatch
Pass errorHandler = new Pass(this, "handle failure");
custom.addCatch(errorHandler);
// retry the task if something goes wrong
custom.addRetry(RetryProps.builder()
.errors(List.of(Errors.ALL))
.interval(Duration.seconds(10))
.maxAttempts(5)
.build());
Chain chain = Chain.start(custom).next(finalStatus);
StateMachine sm = StateMachine.Builder.create(this, "StateMachine")
.definitionBody(DefinitionBody.fromChainable(chain))
.timeout(Duration.seconds(30))
.comment("a super cool state machine")
.build();
// don't forget permissions. You need to assign them
table.grantWriteData(sm);
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMatches any Error.static final StringA branch of a Parallel state failed.static final StringA Task State failed to heartbeat for a time longer than the “HeartbeatSeconds” value.static final StringA Choice state failed to find a match for the condition field extracted from its input.static final StringWithin a state’s “Parameters” field, the attempt to replace a field whose name ends in “.$” using a Path failed.static final StringA Task State failed because it had insufficient privileges to execute the specified code.static final StringA Task State’s “ResultPath” field cannot be applied to the input the state received.static final StringA Task State failed during the execution.static final StringA Task State either ran longer than the “TimeoutSeconds” value, or failed to heartbeat for a time longer than the “HeartbeatSeconds” value. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
ALL
Matches any Error. -
BRANCH_FAILED
A branch of a Parallel state failed. -
HEARTBEAT_TIMEOUT
A Task State failed to heartbeat for a time longer than the “HeartbeatSeconds” value. -
NO_CHOICE_MATCHED
A Choice state failed to find a match for the condition field extracted from its input. -
PARAMETER_PATH_FAILURE
Within a state’s “Parameters” field, the attempt to replace a field whose name ends in “.$” using a Path failed. -
PERMISSIONS
A Task State failed because it had insufficient privileges to execute the specified code. -
RESULT_PATH_MATCH_FAILURE
A Task State’s “ResultPath” field cannot be applied to the input the state received. -
TASKS_FAILED
A Task State failed during the execution. -
TIMEOUT
A Task State either ran longer than the “TimeoutSeconds” value, or failed to heartbeat for a time longer than the “HeartbeatSeconds” value.
-
-
Constructor Details
-
Errors
protected Errors(software.amazon.jsii.JsiiObjectRef objRef) -
Errors
protected Errors(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Errors
@Stability(Stable) public Errors()
-