github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/processors/catch.md (about)

     1  ---
     2  title: catch
     3  type: processor
     4  status: stable
     5  categories: ["Composition"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/processor/catch.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  
    19  Applies a list of child processors _only_ when a previous processing step has
    20  failed.
    21  
    22  ```yaml
    23  # Config fields, showing default values
    24  label: ""
    25  catch: []
    26  ```
    27  
    28  Behaves similarly to the [`for_each`](/docs/components/processors/for_each) processor, where a
    29  list of child processors are applied to individual messages of a batch. However,
    30  processors are only applied to messages that failed a processing step prior to
    31  the catch.
    32  
    33  For example, with the following config:
    34  
    35  ```yaml
    36  pipeline:
    37    processors:
    38      - resource: foo
    39      - catch:
    40        - resource: bar
    41        - resource: baz
    42  ```
    43  
    44  If the processor `foo` fails for a particular message, that message
    45  will be fed into the processors `bar` and `baz`. Messages that do not
    46  fail for the processor `foo` will skip these processors.
    47  
    48  When messages leave the catch block their fail flags are cleared. This processor
    49  is useful for when it's possible to recover failed messages, or when special
    50  actions (such as logging/metrics) are required before dropping them.
    51  
    52  More information about error handing can be found [here](/docs/configuration/error_handling).
    53  
    54