ORPCTaggedError creates Effect-native tagged error classes for oRPC procedures.
import.ts
Basic error
basic.ts
USER_NOT_FOUND_ERROR.
Error with options
with-options.ts
Error with typed data
with-data.ts
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Factory for yieldable Effect errors that convert to oRPC errors.
ORPCTaggedError creates Effect-native tagged error classes for oRPC procedures.
import { ORPCTaggedError } from "effect-orpc";
class UserNotFoundError extends ORPCTaggedError("UserNotFoundError") {}
USER_NOT_FOUND_ERROR.
class ValidationError extends ORPCTaggedError("ValidationError", {
code: "BAD_REQUEST",
status: 400,
message: "Validation failed",
}) {}
class UserNotFoundError extends ORPCTaggedError("UserNotFoundError", {
code: "NOT_FOUND",
status: 404,
schema: z.object({ id: z.string() }),
}) {}
return yield * new UserNotFoundError({ data: { id: "1" } });
| Export | Purpose |
|---|---|
isORPCTaggedError(value) | Check an error instance. |
isORPCTaggedErrorClass(value) | Check an error class. |
toORPCError(error) | Convert to an ORPCError. |
effectErrorMapToErrorMap(map) | Convert an Effect error map to an oRPC error map. |
createEffectErrorConstructorMap(map) | Build constructors for handler errors. |
Was this page helpful?