class JetStreamStreamError
extends Error
Since 0.5.0

Thrown by NatsBroker.connect when the JetStream stream could not be ensured: the stream is absent and NatsOptions.streamSubjects was not supplied, or the platform refused the stream read/create. The platform's own error is carried as cause when there is one.

The message names both remedies: create the stream out of band (for example nats stream add <name>), or supply NatsOptions.streamSubjects so the broker can create it with explicit subjects. The broker deliberately sends no catch-all subject: NATS refuses subjects: ['>'] without no_ack, and with no_ack every publish would reject unobserved — so a subject set must come from the application.

Constructors

JetStreamStreamError(
stream: string,
cause?: unknown
)

Creates the error reported when the stream could not be ensured.

Parameters
stream: string

The JetStream stream name

optional
cause: unknown

The platform error, when the stream read/create was attempted and rejected; omitted when the stream is simply absent and no subject set was configured

Properties

readonly
stream: string

The stream name the broker tried to ensure.

Usage

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