Error Handling (v1)
This documents the old v1 API. See Getting Started for the current version.
Procedure (RPC) errors
Section titled “Procedure (RPC) errors”Thrown errors are not serialized back to the client. The client call may reject due to RPC timeout.
Recommended pattern
Section titled “Recommended pattern”// Server — return a typed result.handle(({ input }) => { if (!isValid(input)) { return { ok: false as const, error: "VALIDATION_FAILED" as const }; } return { ok: true as const };})
// Clientconst res = await client.doSomething(/* ... */);if (!res.ok) console.error(res.error);Connection errors
Section titled “Connection errors”client.onError((err) => { console.error("Socket error:", err);});