Skip to main content

error

Returns an error for all records that get passed to the processor.

Description

Any time a record is passed to this processor it returns an error, which results in the record being sent to the DLQ if it's configured, or the pipeline stopping.

Important: Make sure to add a condition to this processor, otherwise all records will trigger an error.

Configuration parameters

version: 2.2
pipelines:
- id: example
status: running
connectors:
# define source and destination ...
processors:
- id: example
plugin: "error"
settings:
# Error message to be returned. This can be a Go
# [template](https://pkg.go.dev/text/template) executed on each
# [`Record`](https://pkg.go.dev/github.com/conduitio/conduit-commons/opencdc#Record)
# being processed.
# Type: string
message: "error processor triggered"
# Whether to decode the record key using its corresponding schema from
# the schema registry.
# Type: bool
sdk.schema.decode.key.enabled: "false"
# Whether to decode the record payload using its corresponding schema
# from the schema registry.
# Type: bool
sdk.schema.decode.payload.enabled: "false"
# Whether to encode the record key using its corresponding schema from
# the schema registry.
# Type: bool
sdk.schema.encode.key.enabled: "false"
# Whether to encode the record payload using its corresponding schema
# from the schema registry.
# Type: bool
sdk.schema.encode.payload.enabled: "false"

Examples

Error record with custom error message

This example shows how to configure the error processor to return a custom error message for a record using a Go template.

Configuration parameters

version: 2.2
pipelines:
- id: example
status: running
connectors:
# define source and destination ...
processors:
- id: example
plugin: "error"
settings:
message: "custom error message with data from record: {{.Metadata.foo}}"

Record difference

Before
After
1
{
1
{
2
-
  "position": null,
2
+
  "error": "custom error message with data from record: bar"
3
-
  "operation": "create",
4
-
  "metadata": {
5
-
    "foo": "bar"
6
-
  },
7
-
  "key": null,
8
-
  "payload": {
9
-
    "before": {
10
-
      "bar": "baz"
11
-
    },
12
-
    "after": {
13
-
      "foo": "bar"
14
-
    }
15
-
  }
16
}
3
}

scarf pixel conduit-site-docs-using-processors