class IntegrationEventRejectedError
extends Error
Since 0.6.0

Thrown by onIntegrationEvent's wrapper when a delivered message is refused before the application handler runs. One class rather than four keeps the consumer's instanceof branch a single import, while reason discriminates.

The message carries the whole diagnostic on its own — the reason, the topic, and the expected against the observed type/version — because the default in-memory composition's dispatch reporter flattens a rejection to error.message in one log string, so on that path the structured fields never reach an operator and the message is all that survives. The fields serve an application's instanceof branch on a path that surfaces the error object itself (a real broker's nack handler, or a bespoke sink on the 'custom' broker arm).

For reason: 'parse', the thrown parser error is carried as cause — a schema error's field paths are the most useful diagnostic in the whole path. The field is typed unknown and set verbatim: a parser that throws a non-Error value (a string, most commonly) is preserved as-is, and the rejection's own message still names the topic and reason without it.

Constructors

IntegrationEventRejectedError(details: { reason: IntegrationEventRejectionReason; topic: string; expectedType: string; expectedVersion: number; detail: string; cause?: unknown; })

Creates the rejection. The message is composed here so every refusal reads the same way on the flattened log path.

Parameters
details: { reason: IntegrationEventRejectionReason; topic: string; expectedType: string; expectedVersion: number; detail: string; cause?: unknown; }

The refusal's structured fields, the human-readable detail naming the observed fault, and the parser's thrown value as cause when reason is 'parse'

Properties

readonly
expectedType: string

The type the consuming definition expects.

readonly
expectedVersion: number

The version the consuming definition expects.

Why the delivery was refused.

readonly
topic: string

The topic the message was consumed from.

Usage

import { IntegrationEventRejectedError } from "messaging-plugin/src/index.ts";