akiomik / akiomik/nosvelte

Relay failures never reach ReqResult.error

Offen
#83 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
TypeScript
Sterne
29
Forks
3
Ø Merge
3 Std. 5 Min.
Gemergte PRs (30 T.)
11

Beschreibung

`ReqResult.error` is typed `Readable` (`src/lib/stores/types.ts:19`) and every
component branches on it before anything else, but nothing that goes wrong at the
relay layer can ever set it.

rx-nostr states it explicitly (`node_modules/rx-nostr/src/rx-nostr/interface.ts:92-94`):
`createAllErrorObservable()` "is the only way to receive errors arising from
multiplexed websocket connections. (It means that Observables returned by `use()`
never throw error)."

- Relay-side failures surface on `createAllErrorObservable()`, which nosvelte never
subscribes to.
- Connection failures surface as `ConnectionStatePacket`; `useReq()` does not
observe those either, and rx-nostr merely counts a dead relay as "finished".
- A relay-sent `CLOSED` becomes a `ClosedPacket` and is handled internally
(`connection/subscribe.ts:64-75`); it never reaches the `use()` consumer.

So the only thing that can populate `.error` is an exception thrown by an operator
in the pipe — the rarest failure mode in this library. A relay that rejects the
subscription, returns a 4xx on the upgrade, or dies mid-stream produces no error at
all: the request simply returns fewer events, or stalls.

Determined by code reading of the installed rx-nostr source.

## Direction

Relay-level failures are per-relay and non-fatal — they are diagnostics, not a
reason to fail the whole request. Surfacing them needs a separate channel fed by
`createAllErrorObservable()` / `createConnectionStateObservable()`, distinct from
whatever represents a fatal error for the request as a whole.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.