Skip to content

DeadLetterBehaviorOptions

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:41

Per-handler (and module-default) options for DeadLetterBehavior.

Supplied per handler via @UsePipeline([DeadLetterBehavior, { ... }]), shallow-merged over the module-wide defaults (handler keys win), except that ignoreErrors and redactKeys set at both levels are combined.

Fire-and-forget event capture

@UsePipeline([DeadLetterBehavior, {
captureKinds: ['event'],
rethrow: false,
redactKeys: ['token'],
}])
export class UserCreatedHandler {}

optional captureKinds?: DeadLetterRequestKind[]

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:65

Request kinds to capture. Default ['event']: a command’s or query’s caller already receives the error. Example: ['command', 'event'] to also keep failed commands.


optional ignoreErrors?: (Type<unknown> | ((…args) => unknown))[] | ((error, context) => boolean)

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:72

Filter predicate or error types to ignore. Matching errors are re-thrown without being sent to the dead-letter transport. Useful for ignoring expected client validation errors (e.g. ZodValidationError).


optional includeStack?: boolean

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:58

Include the error stack trace in the record. Default true. Set false to keep records lean or avoid leaking internals downstream.


optional metadata?: DeadLetterMetadataFactory

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:77

Produce extra metadata to merge into the dead-letter record.


optional redact?: (payload) => unknown

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:83

Custom redactor function for the captured request payload. When supplied, takes precedence over redactKeys.

unknown

unknown


optional redactKeys?: string[]

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:89

Field names to mask with [REDACTED] in the captured request payload. Case-insensitive matching. Merged on top of DEFAULT_REDACT_KEYS.


optional rethrow?: boolean

Defined in: packages/pipeline-deadletter/src/interfaces/dead-letter-options.interface.ts:52

Whether to re-throw the original error after dead-lettering.

  • true (default) — propagate after the capture decision; the caller sees the failure (HTTP 5xx, command rejection, …). Use for commands/queries.
  • false — on an event handler only, swallow the error when it is captured and the transport delivers it; the pipeline then resolves to undefined and the swallow is logged at error level with the record id. On a command or query handler it is a bootstrap diagnostic and is ignored.