Setu-TS
    Preparing search index...

    Class IntegrationEventRejectedError

    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.

    0.6.0

    Hierarchy

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

      Parameters

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

        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'

      Returns IntegrationEventRejectedError

    cause?: unknown
    expectedType: string

    The type the consuming definition expects.

    expectedVersion: number

    The version the consuming definition expects.

    message: string
    name: string

    Why the delivery was refused.

    stack?: string
    topic: string

    The topic the message was consumed from.

    stackTraceLimit: number

    The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

    The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

    If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

    • Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

      const myObject = {};
      Error.captureStackTrace(myObject);
      myObject.stack; // Similar to `new Error().stack`

      The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

      The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

      The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

      function a() {
      b();
      }

      function b() {
      c();
      }

      function c() {
      // Create an error without stack trace to avoid calculating the stack trace twice.
      const { stackTraceLimit } = Error;
      Error.stackTraceLimit = 0;
      const error = new Error();
      Error.stackTraceLimit = stackTraceLimit;

      // Capture the stack trace above function b
      Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
      throw error;
      }

      a();

      Parameters

      • targetObject: object
      • OptionalconstructorOpt: Function

      Returns void

    • Parameters

      • err: Error
      • stackTraces: CallSite[]

      Returns any