You can raise custom errors using the `raise` syntax, and you can catch and
handle errors using a
[`try/except` block](https://docs.cloud.google.com/workflows/docs/reference/syntax/catching-errors).

Errors can be either a string or a map. You can use user-defined keys:

### YAML

```yaml
  - STEP_NAME:
      raise:
          KEY_1: VALUE_1
          KEY_2: VALUE_2
```

### JSON

```json
  [
    {
      "STEP_NAME": {
        "raise": {
          "KEY_1": "VALUE_1",
          "KEY_2": "VALUE_2"
        }
      }
    }
  ]
```

## Examples

**String**

### YAML

```yaml
  - step_a:
      raise: "Something went wrong."
```

### JSON

```json
  [
    {
      "step_a": {
        "raise": "Something went wrong."
      }
    }
  ]
```

**Map**

### YAML

```yaml
  - step_a:
      raise:
          code: 55
          message: "Something went wrong."
```

### JSON

```json
  [
    {
      "step_a": {
        "raise": {
          "code": 55,
          "message": "Something went wrong."
        }
      }
    }
  ]
```

## What's next

- [Workflow errors](https://docs.cloud.google.com/workflows/docs/reference/syntax/error-types)
- [Catch errors](https://docs.cloud.google.com/workflows/docs/reference/syntax/catching-errors)
- [Retry steps](https://docs.cloud.google.com/workflows/docs/reference/syntax/retrying)