From 9f11455939c4bd3bf8bc790b0fa067c9792df08d Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Wed, 4 Sep 2024 16:57:40 +0100 Subject: [PATCH] Better error when there are bad responses --- apps/webapp/app/utils/longPollingFetch.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/webapp/app/utils/longPollingFetch.ts b/apps/webapp/app/utils/longPollingFetch.ts index 94ea0851d..7d183d3ac 100644 --- a/apps/webapp/app/utils/longPollingFetch.ts +++ b/apps/webapp/app/utils/longPollingFetch.ts @@ -12,7 +12,8 @@ export async function longPollingFetch(url: string, options?: RequestInit) { // Check if the response is ok (status in the range 200-299) if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); + const body = await response.text(); + throw new Error(`HTTP error! status: ${response.status}. ${body}`); } if (response.headers.get(`content-encoding`)) {