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
{{ message }}
Repository navigation
Commit ef0089f
Browse filesBrowse the repository at this point in the historyBrowse files
fix(client, server, shared): throw distinct errors for timeouts and closed connections (#2533)
## What
- Timeout plugins (`TimeoutLinkPlugin`, `TimeoutHandlerPlugin`) now
abort with a `TimeoutError`, named like the error of
`AbortSignal.timeout()`. Exported from `@orpc/client` and
`@orpc/server`.
- WebSocket and MessagePort links now reject with a
`ConnectionClosedError` (exported from `@orpc/client`) when the
connection is closed, lost, or cannot be reopened.
- User cancellation stays `AbortError`.
## Why
Both cases were thrown as `AbortError`, so they looked like the user
calling `signal.abort()`. Tracing recorded them at `info` instead of
failing the span, pino/evlog treated them as benign aborts, and users
could only tell them apart by message string.
`isAbortError`, `recordSpanError`, the loggers and the retry plugin need
no logic change: the new names do not contain `Abort`, so they are now
treated as failures, and `isRetryableError` already retries errors
without a response.
## Breaking
- Timeouts reject / set `signal.reason` to `TimeoutError` instead of
`AbortError`.
- WebSocket and MessagePort links reject with `ConnectionClosedError`
instead of `AbortError`.
Messages are unchanged.
## Notes for review
- Server peer adapters still abort the request signal with `AbortError`
when the client goes away, same as an HTTP client disconnecting.
- The fetch link is untouched: a dropped HTTP connection already rejects
with the platform `TypeError`, which is not an abort.
- A handler that rethrows the `TimeoutError` still responds with a
generic 500.
- In the websocket transport only the error class and its import
changed.
- Docs: the timeout plugin page now says `TimeoutError`; no new
sections.
## Testing
`pnpm check` and `pnpm docs:validate` pass. `pnpm vitest run` passes
except `packages/openapi-inference/src/openapi-generator.test.ts`
("names the nearest tsconfig…"), which fails locally on a `/private/var`
vs `/var` temp-path mismatch and is unrelated. `packages/bun` tests were
not run locally (no `bun`).
0 commit comments