Better error when there are bad responses

This commit is contained in:
Matt Aitken
2024-09-04 16:57:40 +01:00
parent 1791d157e9
commit 9f11455939
+2 -1
View File
@@ -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`)) {