mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
consider all server errors as connection errors
even if they do have an errcode fixes #223
This commit is contained in:
parent
f9979b1a77
commit
0bd0f788e3
@ -29,12 +29,17 @@ class RequestWrapper {
|
|||||||
log?.finish();
|
log?.finish();
|
||||||
return response.body;
|
return response.body;
|
||||||
} else {
|
} 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.`);
|
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);
|
log?.catch(err);
|
||||||
throw err;
|
throw err;
|
||||||
} else {
|
} else {
|
||||||
const err = new HomeServerError(method, url, response.body, response.status);
|
const err = new HomeServerError(method, url, response.body, response.status);
|
||||||
|
log?.set("errcode", err.errcode);
|
||||||
log?.catch(err);
|
log?.catch(err);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user