//#region src/errors.d.ts /** * Typed error hierarchy surfaced by `@graphorin/client`. Every error * class extends the JavaScript built-in `Error` and exposes a stable * `kind` discriminator so consumers can pattern-match without * relying on `instanceof` (which behaves badly across module-system * boundaries when the package is dual-loaded). * * @packageDocumentation */ /** * Map a JSON-RPC error code from a server `RpcFailure` frame to the * client's discriminated {@link GraphorinClientErrorKind}, so a rate-limited * or scope-denied RPC is distinguishable from a genuine protocol violation. */ declare function kindForRpcCode(code: number): GraphorinClientErrorKind; /** * Discriminator union of every error kind raised by the client. * * @stable */ type GraphorinClientErrorKind = 'client-not-connected' | 'transport-failed' | 'subprotocol-mismatch' | 'auth-failed' | 'protocol-violation' | 'subscription-not-found' | 'rate-limited' | 'scope-denied' | 'run-not-found' | 'server-error' | 'aborted' /** * The per-subscription client buffer hit * `subscriptionQueueLimit` because the `for await` consumer fell * behind the event flow; the subscription is closed with this typed * error instead of growing the heap or silently dropping frames. */ | 'flow-overflow' | 'invalid-server-frame'; /** * Base class for every error raised by `@graphorin/client`. Carries a * stable {@link GraphorinClientErrorKind} discriminator and an * optional `cause` chain. * * @stable */ declare class GraphorinClientError extends Error { readonly kind: GraphorinClientErrorKind; constructor(kind: GraphorinClientErrorKind, message: string, options?: ErrorOptions); } /** @stable */ declare class ClientNotConnectedError extends GraphorinClientError { constructor(message?: string); } /** @stable */ declare class TransportFailedError extends GraphorinClientError { readonly code: number | undefined; constructor(message: string, options?: ErrorOptions & { readonly code?: number; }); } /** @stable */ declare class SubprotocolMismatchError extends GraphorinClientError { readonly expected: string; readonly actual: string | null; constructor(expected: string, actual: string | null); } /** @stable */ declare class AuthFailedError extends GraphorinClientError { constructor(message?: string); } /** @stable */ declare class ProtocolViolationError extends GraphorinClientError { constructor(message: string, options?: ErrorOptions); } /** @stable */ declare class SubscriptionNotFoundError extends GraphorinClientError { readonly subscriptionId: string; constructor(subscriptionId: string); } /** @stable */ declare class ClientAbortedError extends GraphorinClientError { constructor(message?: string); } /** @stable */ declare class InvalidServerFrameError extends GraphorinClientError { readonly issues: ReadonlyArray<{ path: ReadonlyArray; message: string; }>; constructor(message: string, issues: ReadonlyArray<{ path: ReadonlyArray; message: string; }>); } //#endregion export { AuthFailedError, ClientAbortedError, ClientNotConnectedError, GraphorinClientError, GraphorinClientErrorKind, InvalidServerFrameError, ProtocolViolationError, SubprotocolMismatchError, SubscriptionNotFoundError, TransportFailedError, kindForRpcCode }; //# sourceMappingURL=errors.d.ts.map