mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Throw ConnectionError instead of swallowing error
This commit is contained in:
parent
c898bcb46a
commit
ff706e542d
@ -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 New Issue
Block a user