Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
743 B ยท 30 lines
TypeScript
12345678910111213141516171819202122232425262728293031import type { ZodError } from "zod";
import { BaseError } from "./base-error";import type { ErrorCode } from "./error-code";import { parseZodErrorIssues } from "./utils";
type Context = { raw: unknown };
export class SchemaError extends BaseError<Context> { public readonly name = SchemaError.name; public readonly code: ErrorCode;
constructor(opts: { code: ErrorCode; message: string; cause?: BaseError; context?: Context; }) { super(opts); this.code = opts.code; }
static fromZod<T>(e: ZodError<T>, raw: unknown): SchemaError { return new SchemaError({ code: "UNPROCESSABLE_ENTITY", message: parseZodErrorIssues(e.issues), context: { raw: JSON.stringify(raw) }, }); }}