Perform error handling in a parallel step

Uses a try/except structure for error handling in a parallel step.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

YAML

- catchErrors:
    try:
      steps:
        - failOdd:
            parallel:
              for:
                value: num
                range: [0, 5]
                steps:
                  - checkEven:
                      switch:
                        - condition: ${num % 2 != 0}
                          raise: "how odd!"
    except:
      as: e
      steps:
        - log:
            call: sys.log
            args:
              data: ${e}
        - returnError:
            return: ${e}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.