Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Return typed Effect errors from procedures.
import { ORPCTaggedError } from "effect-orpc"; import * as z from "zod"; class PermissionDenied extends ORPCTaggedError("PermissionDenied", { code: "FORBIDDEN", status: 403, message: "Permission denied", schema: z.object({ requiredRole: z.string(), actualRole: z.string() }), }) {}
const adminProcedure = eos .$context<{ role: "viewer" | "admin" }>() .errors({ PermissionDenied }) .use(function* ({ context }) { if (context.role !== "admin") { return yield* new PermissionDenied({ data: { requiredRole: "admin", actualRole: context.role }, }); } }); export const deleteUser = adminProcedure.effect(function* () { return { deleted: true }; });
Was this page helpful?