2

I'd like my state machine to continue execution even in the event of some state error early on. Most of my lambda functions output the same thing they take as input, so I'd like to be able to just pass on the input that the lambda that encountered the error as output to the next state. I tried

{
    "DeleteStuff": {
      "Type": "Task",
      "Resource": "MY_ARN",
      "Catch": [ {
        "ErrorEquals": ["States.ALL"],
        "ResultPath": "$InputPath",
        "Next": "FailedState"
      }],
      "Next": "checkStuff"
    }, ...

without any luck. Has anyone done this, or can anyone offer some assistance?

Thanks!

2 Answers 2

4

So the solution is the set ResultPath to null. Changing my state machine to

{
    "DeleteStuff": {
      "Type": "Task",
      "Resource": "MY_ARN",
      "Catch": [ {
        "ErrorEquals": ["States.ALL"],
        "ResultPath": null,
        "Next": "FailedState"
      }],
      "Next": "checkStuff"
    }, ...

gave me the desired behaviour.

Sign up to request clarification or add additional context in comments.

Comments

2

if you just add a new path to the result path, it is added to the input:

{
    "ErrorEquals": ["States.ALL"],
    "ResultPath": "$.error",
    "Next": "Catch All Error Handler"
}

so if your input was:

{
    "data_a" : "aaa",
    "data_b" : "bbb"
}

output will be:

{
    "data_a" : "aaa",
    "data_b" : "bbb",
    "error" : "<error description>"
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.