diff --git a/frontend/package.json b/frontend/package.json index 0cdd7ff..8154c4c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "mangalord-frontend", - "version": "0.128.2", + "version": "0.128.3", "private": true, "type": "module", "scripts": { diff --git a/frontend/src/lib/api/client.ts b/frontend/src/lib/api/client.ts index 860a437..7fe5a30 100644 --- a/frontend/src/lib/api/client.ts +++ b/frontend/src/lib/api/client.ts @@ -106,12 +106,16 @@ export async function request( let res: Response; try { res = await fetch(`${BASE}${path}`, { credentials: 'include', ...init }); - } catch { - // A network-level failure (connection refused, DNS, offline, blocked by - // CORS) rejects `fetch` with a bare TypeError instead of returning a - // response. Normalise it to an ApiError (status 0 = "no response reached - // us") so callers and SvelteKit load functions handle it uniformly - // instead of crashing on an unexpected TypeError. + } catch (e) { + // A deliberate cancellation (AbortController) must propagate unchanged so + // callers can tell "cancelled" from "network failure" (e.g. the + // cancellable admin fetches treat AbortError as a no-op). + if (e instanceof DOMException && e.name === 'AbortError') throw e; + // Any other rejection is a network-level failure (connection refused, + // DNS, offline, blocked by CORS): `fetch` rejects with a bare TypeError + // instead of returning a response. Normalise it to an ApiError (status 0 + // = "no response reached us") so callers and SvelteKit load functions + // handle it uniformly instead of crashing on an unexpected TypeError. throw new ApiError( 0, 'network_error',