Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel state should allow Catch property #2

Closed
mrgrain opened this issue Nov 23, 2017 · 2 comments
Closed

Parallel state should allow Catch property #2

mrgrain opened this issue Nov 23, 2017 · 2 comments

Comments

@mrgrain
Copy link

mrgrain commented Nov 23, 2017

Given a Parallel state

{
  "States": {
    "A": {
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "B",
          "States": {
            "B": {
              "Type": "Fail"
            }
          }
        },
        {
          "StartAt": "C",
          "States": {
            "C": {
              "Type": "Pass",
              "End": true
            }
          }
        }
      ],
      "Catch": {
        "ErrorEquals": [
          "States.ALL"
        ],
        "Next": "D"
      }
    },
    "D": {
      "Type": "Fail"
    }
  }
}

It should allow the Catch property: http://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-parallel-state.html?shortFooter=true

However it fails.

Version 1.0.2

@ChristopheBougere
Copy link
Owner

Hi @mrgrain,
You are right, it is missing the Catch property in Parallel.
However, in your example:

  • It is missing the StartAt property of the state machine, which makes it fail at first
  • You must provide either Nextor End in your Parallel state
  • Catch property must be an array, as defined here

Which results in this:

{
  "StartAt": "A",
  "States": {
    "A": {
      "Type": "Parallel",
      "Next": "D",
      "Branches": [{
          "StartAt": "B",
          "States": {
            "B": {
              "Type": "Fail"
            }
          }
        },
        {
          "StartAt": "C",
          "States": {
            "C": {
              "Type": "Pass",
              "End": true
            }
          }
        }
      ],
      "Catch": [{
        "ErrorEquals": [
          "States.ALL"
        ],
        "Next": "D"
      }]
    },
    "D": {
      "Type": "Fail"
    }
  }
}

Fixed in 1.0.3. Feel free to reopen if needed

@mrgrain
Copy link
Author

mrgrain commented Nov 28, 2017

Thanks, in the example I was trying to simplify my state machine - obviously not with much success.

ChristopheBougere pushed a commit that referenced this issue Nov 28, 2017
ChristopheBougere added a commit that referenced this issue Jul 7, 2022
* chore: rewrite to typescript

BREAKING CHANGE: updated the json path error

* fix: typescript review (remove any)

* feat: integrate asl path validator (#2)

* feat(paths): update to latest path validator

* chore: resolve conflicts

* chore: merge cleanup

* refactor: extract arn formatter and added tests

* fix: restored support for array

* fix: restored support for cloud formation functions for resources

* feat: better filtering of error messages
tests: added new test for asserting error messages
chore: updated tsconfig to keep js files out of src

Co-authored-by: Christophe Bougère <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants