Initial commit

This commit is contained in:
Developer
2026-02-06 21:44:04 -06:00
commit f85e93c7a6
151 changed files with 22916 additions and 0 deletions

20
lib/errors.ts Normal file
View File

@@ -0,0 +1,20 @@
export class PublicError extends Error {
code: string;
constructor(code: string, message?: string) {
super(message ?? code);
this.code = code;
}
}
export function publicMessageFor(code: string) {
// Consumer-safe message - only for sensitive pages like auth
return "Something went wrong. Please contact the website owner.";
}
export function createValidationError(message: string) {
return new PublicError("VALIDATION_ERROR", message);
}
export function isPublicError(err: unknown): err is PublicError {
return typeof err === "object" && err !== null && "code" in err && err instanceof Error;
}