* chore(release): v5.1.0

* feat: implement resume thumbnails

* fix: remove unused mcp tools

* docs: fix formatting of docs
This commit is contained in:
Amruth Pillai
2026-05-07 15:12:33 +02:00
committed by GitHub
parent 51c366310e
commit 50ba37a27f
1015 changed files with 106087 additions and 141872 deletions
+36
View File
@@ -0,0 +1,36 @@
import { ORPCError } from "@orpc/client";
export function getReadableErrorMessage(error: unknown, fallback: string): string {
if (typeof error === "string" && error) return error;
if (error instanceof Error && error.message) return error.message;
return fallback;
}
type ErrorMessageByCode = Record<string, string>;
export function getOrpcErrorMessage(
error: unknown,
options: {
fallback: string;
byCode?: ErrorMessageByCode;
allowServerMessage?: boolean;
},
): string {
if (!(error instanceof ORPCError)) return getReadableErrorMessage(error, options.fallback);
const mappedMessage = options.byCode?.[error.code];
if (mappedMessage) return mappedMessage;
if (options.allowServerMessage && error.message) return error.message;
return options.fallback;
}
export function getResumeErrorMessage(error: unknown): string {
return getOrpcErrorMessage(error, {
byCode: {
RESUME_SLUG_ALREADY_EXISTS: "A resume with this slug already exists.",
RESUME_LOCKED: "This resume is locked. Unlock it first to make changes.",
},
fallback: "Something went wrong. Please try again.",
});
}