From ff706e542d73743d053fbfa0a0cfc8925b41e5e9 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 10 Aug 2022 22:23:51 +0530 Subject: [PATCH] Throw ConnectionError instead of swallowing error --- src/platform/web/dom/request/fetch.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/web/dom/request/fetch.js b/src/platform/web/dom/request/fetch.js index eb4caab6..5f6dcb65 100644 --- a/src/platform/web/dom/request/fetch.js +++ b/src/platform/web/dom/request/fetch.js @@ -119,10 +119,10 @@ export function createFetchRequest(createTimeout, serviceWorkerHandler) { body = await response.text(); } } catch (err) { - // some error pages return html instead of json, ignore error - if (!(err.name === "SyntaxError" && status >= 400)) { - throw err; + if (err.name === "SyntaxError" && status >= 400) { + throw new ConnectionError(`${method} ${url}: Failed to fetch JSON file!`); } + throw err; } return {status, body}; }, err => {