# try

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [connect-full.txt](https://docs.redpanda.com/connect-full.txt)

---
title: try
latest-connect-version: 4.93.0
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-redpanda-tag: v26.1.9
docname: processors/try
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: processors/try.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/processors/try.adoc
page-git-created-date: "2024-05-24"
page-git-modified-date: "2024-09-05"
---

<!-- Source: https://docs.redpanda.com/connect/components/processors/try.md -->

**Available in:** [Cloud](https://docs.redpanda.com/cloud-data-platform/develop/connect/components/processors/try/%20%22View%20the%20Cloud%20version%20of%20this%20component%22), Self-Managed

Executes a list of child processors on messages only if no prior processors have failed (or the errors have been cleared).

```yml
# Config fields, showing default values
label: ""
try: []
```

This processor behaves similarly to the [`for_each`](https://docs.redpanda.com/connect/components/processors/for_each/) processor, where a list of child processors are applied to individual messages of a batch. However, if a message has failed any prior processor (before or during the try block) then that message will skip all following processors.

For example, with the following config:

```yaml
pipeline:
  processors:
    - resource: foo
    - try:
      - resource: bar
      - resource: baz
      - resource: buz
```

If the processor `bar` fails for a particular message, that message will skip the processors `baz` and `buz`. Similarly, if `bar` succeeds but `baz` does not then `buz` will be skipped. If the processor `foo` fails for a message then none of `bar`, `baz` or `buz` are executed on that message.

This processor is useful for when child processors depend on the successful output of previous processors. This processor can be followed with a [catch](https://docs.redpanda.com/connect/components/processors/catch/) processor for defining child processors to be applied only to failed messages.

More information about error handing can be found in [Error Handling](https://docs.redpanda.com/connect/configuration/error_handling/).

## [](#nest-within-a-catch-block)Nest within a catch block

In some cases it might be useful to nest a try block within a catch block, since the [`catch` processor](https://docs.redpanda.com/connect/components/processors/catch/) only clears errors _after_ executing its child processors this means a nested try processor will not execute unless the errors are explicitly cleared beforehand.

This can be done by inserting an empty catch block before the try block like as follows:

```yaml
pipeline:
  processors:
    - resource: foo
    - catch:
      - log:
          level: ERROR
          message: "Foo failed due to: ${! error() }"
      - catch: [] # Clear prior error
      - try:
        - resource: bar
        - resource: baz
```