You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(core): qualify ResourceNotFoundError fromError reconstruction; fix cross-bundle example
- JSDoc / changeset / migration.md now state that ProtocolError.fromError
reconstructs ResourceNotFoundError for either code only when error.data
carries `uri`; a bare -32002 without data.uri stays a generic
ProtocolError.
- migration.md example: drop the outer `instanceof ProtocolError` gate
(it defeats the cross-bundle case the prose describes); the example now
feeds code+data straight into fromError and tests the locally-created
result.
Copy file name to clipboardExpand all lines: docs/migration.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1256,18 +1256,21 @@ with the `allowInputRequired: true` request option plus the `withInputRequired()
1256
1256
revisions, so v1.x peers see no change. An interim `-32002` emission that shipped in earlier v2 alphas is reverted: the era encode seam maps any handler-thrown `-32002` to `-32602` on the wire, so a handler written against the older alpha behaves identically without changes.
1257
1257
1258
1258
`ProtocolErrorCode.ResourceNotFound` (`-32002`) **remains importable** as receive-tolerated vocabulary: clients should accept both `-32602` and `-32002` from peers (the specification's backwards-compatibility clause). The new typed `ResourceNotFoundError` class carries the URI on
1259
-
`.uri`, and `ProtocolError.fromError`recognizes both codes by the `data.uri`shape — recognize peers' errors by their code and `error.data`, not by `instanceof`, which does not survive bundling. Servers must not return an empty `contents` array for a non-existent resource (an
1260
-
empty array is ambiguous between "exists but empty" and "does not exist").
1259
+
`.uri`, and `ProtocolError.fromError`reconstructs it for either code when `error.data` carries `uri` (a bare `-32002` without `data.uri`stays a generic `ProtocolError`) — recognize peers' errors by their code and `error.data`, not by `instanceof`, which does not survive
1260
+
bundling. Servers must not return an empty `contents` array for a non-existent resource (an empty array is ambiguous between "exists but empty" and "does not exist").
0 commit comments