fix errors when replaying

This commit is contained in:
Bruno Windels 2020-03-17 00:07:54 +01:00
parent ff9e55e49c
commit b69efc3425
2 changed files with 5 additions and 5 deletions

View file

@ -1,8 +1,8 @@
export class HomeServerError extends Error {
constructor(method, url, body) {
super(`${body.error} on ${method} ${url}`);
this.errcode = body.errcode;
this.retry_after_ms = body.retry_after_ms;
constructor(method, url, body, status) {
super(`${body ? body.error : status} on ${method} ${url}`);
this.errcode = body ? body.errcode : null;
this.retry_after_ms = body ? body.retry_after_ms : 0;
}
get isFatal() {

View file

@ -12,7 +12,7 @@ class RequestWrapper {
} else {
switch (response.status) {
default:
throw new HomeServerError(method, url, response.body);
throw new HomeServerError(method, url, response.body, response.status);
}
}
});