From 975ddf902725627bbe4a003642c02a8dd5e451fb Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 09:14:20 +0000 Subject: [PATCH] Reapply "API client: a 200 that is not JSON is said plainly instead of failing as 'r is null'" This reverts commit 4eb2ee2ee2a650ac6b6784b841813e60b5a29d5d. --- app/ui/shell/api.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/ui/shell/api.js b/app/ui/shell/api.js index 199af4e9..fbb6f015 100644 --- a/app/ui/shell/api.js +++ b/app/ui/shell/api.js @@ -16,6 +16,9 @@ export async function call(method, path, body) { }); const payload = await res.json().catch(() => null); if (!res.ok) throw Object.assign(new Error(why(res, payload)), { status: res.status }); // status: a refusal (4xx) is not an outage + // A 200 that is not JSON is not FunUI answering (ComfyUI restarting, a proxy's page, a route this server does not have): + // saying so beats every caller failing on "r is null". + if (payload === null && res.status !== 204) throw Object.assign(new Error(`FunUI did not answer ${path} (ComfyUI may be restarting, or this page is older than the server: reload the page).`), { status: 502 }); return payload; }