To Nha Notes | Nov. 18, 2024, 11:32 a.m.
States.All Errors: Catch-all for any error not explicitly caught by other patterns.
States.Timeout: Triggered when a state exceeds its allowed execution time.
States.TaskFailed: Raised when a task state fails.
States.Permissions: Occurs due to IAM permission issues.
States.ResultPathMatchFailure: When the result path doesn't match.
States.BranchFailed: Raised if a parallel state fails.
States.NoChoiceMatched: No match found for a Choice state.
States.ParameterPathFailure: When a parameter path evaluation fails.
Retry: Automatically retry a failed state.
Catch: Capture errors and redirect execution to a recovery path.
Timeout: Specify a maximum time a state should run.
You will notice that at each step in the State Machine you have incorporated a Retry statement. This statement includes a list of conditions that should trigger a retry in a step, along with specific parameters that go along with the retry. To break down the different parameters in the Retry block:
"X": {
"Type": "Task",
"Resource": "arn:aws:states:us-east-1:123456789012:task:X",
"Next": "Y",
"Retry": [ {
"ErrorEquals": [ "ErrorA", "ErrorB" ],
"IntervalSeconds": 1,
"BackoffRate": 2.0,
"MaxAttempts": 2
}, {
"ErrorEquals": [ "ErrorC" ],
"IntervalSeconds": 5
} ],
"Catch": [ {
"ErrorEquals": [ "States.ALL" ],
"Next": "Z"
} ]
}
This task fails four times in succession, outputting these error names: ErrorA, ErrorB, ErrorC, and ErrorB. The following occurs as a result:
The first two errors match the first retrier and cause waits of one and two seconds.
The third error matches the second retrier and causes a wait of five seconds.
The fourth error also matches the first retrier. However, it already reached its maximum of two retries (MaxAttempts) for that particular error. Therefore, that retrier fails and the execution redirects the workflow to the Z state through the Catch field.
https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html