Standardise frontend hook fetch error handling and mark Task 12 done

This commit is contained in:
2026-03-22 10:17:15 +01:00
parent bf2abda595
commit 136f21ecbe
17 changed files with 62 additions and 45 deletions

View File

@@ -0,0 +1,14 @@
/**
* Normalize fetch error handling across hooks.
*/
export function handleFetchError(
err: unknown,
setError: (value: string | null) => void,
fallback: string = "Unknown error",
): void {
if (err instanceof DOMException && err.name === "AbortError") {
return;
}
setError(err instanceof Error ? err.message : fallback);
}