vector-im-hydrogen-web/src/matrix/error.js

26 lines
649 B
JavaScript
Raw Normal View History

2018-12-21 14:35:24 +01:00
export class HomeServerError extends Error {
2020-03-17 00:07:54 +01:00
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;
2020-04-18 19:16:16 +02:00
this.statusCode = status;
2019-06-26 22:31:36 +02:00
}
2019-07-01 10:00:29 +02:00
get name() {
return "HomeServerError";
2019-07-01 10:00:29 +02:00
}
2019-02-04 23:31:35 +01:00
}
export {AbortError} from "../utils/error.js";
2019-02-10 21:25:29 +01:00
export class ConnectionError extends Error {
constructor(message, isTimeout) {
super(message || "ConnectionError");
this.isTimeout = isTimeout;
}
get name() {
return "ConnectionError";
}
2019-03-08 12:26:59 +01:00
}