Throw ConnectionError instead of swallowing error
This commit is contained in:
parent
c898bcb46a
commit
ff706e542d
1 changed files with 3 additions and 3 deletions
|
@ -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 => {
|
||||
|
|
Reference in a new issue