mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
Merge pull request #267 from vector-im/bwindels/fix-223
consider all server errors as connection errors
This commit is contained in:
commit
b4f4594ead
@ -29,12 +29,17 @@ class RequestWrapper {
|
||||
log?.finish();
|
||||
return response.body;
|
||||
} else {
|
||||
if (response.status >= 400 && !response.body?.errcode) {
|
||||
if (response.status >= 500) {
|
||||
const err = new ConnectionError(`Internal Server Error`);
|
||||
log?.catch(err);
|
||||
throw err;
|
||||
} else if (response.status >= 400 && !response.body?.errcode) {
|
||||
const err = new ConnectionError(`HTTP error status ${response.status} without errcode in body, assume this is a load balancer complaining the server is offline.`);
|
||||
log?.catch(err);
|
||||
throw err;
|
||||
} else {
|
||||
const err = new HomeServerError(method, url, response.body, response.status);
|
||||
log?.set("errcode", err.errcode);
|
||||
log?.catch(err);
|
||||
throw err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user