Errors¶
Exported¶
| Error | Returned by | Meaning |
|---|---|---|
ErrNoStream |
JetStream backend's Open |
The stream does not exist. The bus binds and never creates. The error is wrapped with the stream name. |
ErrMemoryStream |
JetStream backend's Open |
The stream is memory-backed. The backend declares SurvivesRestart, which a memory stream would make untrue. The error is wrapped with the stream name. |
ErrSessionClosed |
Request |
The session closed while a request was waiting, or Request was called on a closed session. It returns at once instead of at the deadline. |
All three are errors.NewSentinel values from go/errors; test for them with errors.Is. Their codes
are messaging_nats.no_stream, messaging_nats.memory_stream and messaging-nats.session_closed. The
last has a hyphen where the first two have an underscore; that is what the source says.
Source: jetstream.go and request.go.
Refusals from Open¶
Open is called by Bus.Start. Each failure wraps the underlying error with a prefix.
| Wrapper text | Cause |
|---|---|
messaging-nats: building the client |
client.Connect failed: invalid settings or credentials. |
messaging-nats: starting the client |
Start failed. |
messaging-nats: waiting for the connection |
WaitReady failed, usually because ctx ended first. The client is stopped. |
messaging-nats: the JetStream context |
The client could not produce a JetStream context. The client is closed. |
messaging-nats: binding stream "<name>" |
Looking the stream up failed for a reason other than it being absent. |
Refusals from Subscribe¶
| Message | Cause |
|---|---|
ErrNotSupported, "<mode> delivery on core NATS" |
An AtLeastOnce subscription on Core. |
ErrNotSupported, "overflow <policy> on core NATS" |
An overflow policy other than OverflowNative or ShedNewest on a core subscription. |
ErrNotSupported, "<mode> delivery" |
A mode on JetStream that is neither AtMostOnce nor AtLeastOnce. |
| "the session is closed" | Subscribe on a closed session. |
"durable <name> exists with a different <field>" |
See Subscribe durably. |
"creating consumer <name> on <stream>" |
The server refused the consumer for another reason. |
The core usually refuses a mode or overflow policy before the adapter does, at construction, from the declared capabilities. The adapter's own checks are the second line.
Settlement¶
A settlement after the source has retired returns messaging.ErrSettlementRefused, wrapped with the
source name.