Skip to content

Error Handling (v1)

This documents the old v1 API. See Getting Started for the current version.

Thrown errors are not serialized back to the client. The client call may reject due to RPC timeout.

// 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 };
})
// Client
const res = await client.doSomething(/* ... */);
if (!res.ok) console.error(res.error);
client.onError((err) => {
console.error("Socket error:", err);
});