Skip to content

RpcClientError

Client-side protocol failures reported by unstable RPC transports.

RpcClientError is the error type generated clients use when a call fails before a remote handler can return its declared typed error. Its reason covers built-in transport failures from HTTP, sockets, and workers, plus RpcClientDefect values for malformed or incompatible protocol data.

2 exports Added in v4.0.0 Source

Errors

Represents a client-side RPC defect, such as a protocol violation or decoding failure, with a message and original cause.

Signature

declare class RpcClientDefect extends {
  readonly _tag: "RpcClientDefect";
  readonly cause: unknown;
  readonly message: string;
} & YieldableError<this> {
  constructor(...args: [props: {
    readonly _tag?: "RpcClientDefect";
    readonly cause: unknown;
    readonly message: string;
  }, options?: MakeOptions]);
}

Error wrapper for RPC client failures, including worker, socket, HTTP client, and client protocol defect failures.

Signature

declare class RpcClientError extends {
  readonly _tag: "RpcClientError";
  readonly reason: HttpClientErrorSchema | RpcClientDefect | WorkerSpawnError | WorkerSendError | WorkerReceiveError | WorkerUnknownError | SocketReadError | SocketWriteError | SocketOpenError | SocketCloseError;
} & YieldableError<this> {
  constructor(...args: [props: {
    readonly _tag?: "RpcClientError";
    readonly reason: HttpClientErrorSchema | RpcClientDefect | WorkerSpawnError | WorkerSendError | WorkerReceiveError | WorkerUnknownError | SocketReadError | SocketWriteError | SocketOpenError | SocketCloseError;
  }, options?: MakeOptions]);
  readonly "~effect/rpc/RpcClientError": "~effect/rpc/RpcClientError";
  message: string;
}