v3: error cards across the app, friendly network errors, code quality pass

This commit is contained in:
khannurien
2026-03-21 19:17:23 +00:00
parent 608c6bc6a8
commit 5bed03baa5
21 changed files with 206 additions and 121 deletions

10
src/utils/apiError.ts Normal file
View File

@@ -0,0 +1,10 @@
/**
* Convert a caught fetch error into a human-readable message.
* TypeError means the request never left the client (no network / CORS / etc.).
*/
export function friendlyFetchError(err: unknown): string {
if (err instanceof TypeError) {
return "Could not connect to the server. Check your connection and try again.";
}
return err instanceof Error ? err.message : "An unexpected error occurred.";
}