Raise errors (original) (raw)
Raise errors
You can raise custom errors using the raise syntax, and you can catch and handle errors using atry/except block.
Errors can be either a string or a map. You can use user-defined keys:
YAML
- STEP_NAME: raise: KEY_1: VALUE_1 KEY_2: VALUE_2
JSON
[ { "STEP_NAME": { "raise": { "KEY_1": "VALUE_1", "KEY_2": "VALUE_2" } } } ]
Examples
String
YAML
- step_a: raise: "Something went wrong."
JSON
[ { "step_a": { "raise": "Something went wrong." } } ]
Map
YAML
- step_a: raise: code: 55 message: "Something went wrong."
JSON
[ { "step_a": { "raise": { "code": 55, "message": "Something went wrong." } } } ]
What's next
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-15 UTC.