MCPcopy Create free account
hub / github.com/QuantiaAI/helm-agents / authErrorMessage

Function authErrorMessage

apps/web/src/lib/auth-error.ts:8–22  ·  view source on GitHub ↗
(err: unknown, t: TFunction)

Source from the content-addressed store, hash-verified

6 * `HTTP <status>`; we match on the known cases and fall back to generic.
7 */
8export function authErrorMessage(err: unknown, t: TFunction): string {
9 const msg = err instanceof Error ? err.message : String(err);
10 const lower = msg.toLowerCase();
11
12 if (lower.includes("401") || lower.includes("invalid")) {
13 return t("invalidCreds");
14 }
15 if (lower.includes("409") || lower.includes("exist") || lower.includes("taken")) {
16 return t("emailTaken");
17 }
18 if (lower.includes("400") || lower.includes("password") || lower.includes("8")) {
19 return t("passwordTooShort");
20 }
21 return t("genericError");
22}

Callers 2

onSubmitFunction · 0.90
onSubmitFunction · 0.90

Calls 1

tFunction · 0.85

Tested by

no test coverage detected