forked from mystiq/hydrogen-web
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();
|
body = await response.text();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// some error pages return html instead of json, ignore error
|
if (err.name === "SyntaxError" && status >= 400) {
|
||||||
if (!(err.name === "SyntaxError" && status >= 400)) {
|
throw new ConnectionError(`${method} ${url}: Failed to fetch JSON file!`);
|
||||||
throw err;
|
|
||||||
}
|
}
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
return {status, body};
|
return {status, body};
|
||||||
}, err => {
|
}, err => {
|
||||||
|
|
Loading…
Reference in a new issue