2020-08-05 22:08:55 +05:30
|
|
|
/*
|
|
|
|
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-08-17 14:18:00 +05:30
|
|
|
export class WrappedError extends Error {
|
|
|
|
constructor(message, cause) {
|
|
|
|
super(`${message}: ${cause.message}`);
|
|
|
|
this.cause = cause;
|
|
|
|
}
|
|
|
|
|
|
|
|
get name() {
|
|
|
|
return "WrappedError";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-21 19:05:24 +05:30
|
|
|
export class HomeServerError extends Error {
|
2020-03-17 04:37:54 +05:30
|
|
|
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 22:46:16 +05:30
|
|
|
this.statusCode = status;
|
2019-06-27 02:01:36 +05:30
|
|
|
}
|
2019-07-01 13:30:29 +05:30
|
|
|
|
2020-05-06 23:08:33 +05:30
|
|
|
get name() {
|
|
|
|
return "HomeServerError";
|
2019-07-01 13:30:29 +05:30
|
|
|
}
|
2019-02-05 04:01:35 +05:30
|
|
|
}
|
|
|
|
|
2020-04-04 21:04:46 +05:30
|
|
|
export {AbortError} from "../utils/error.js";
|
2019-02-11 01:55:29 +05:30
|
|
|
|
2020-05-06 23:08:33 +05:30
|
|
|
export class ConnectionError extends Error {
|
|
|
|
constructor(message, isTimeout) {
|
|
|
|
super(message || "ConnectionError");
|
|
|
|
this.isTimeout = isTimeout;
|
|
|
|
}
|
|
|
|
|
|
|
|
get name() {
|
|
|
|
return "ConnectionError";
|
|
|
|
}
|
2019-03-08 16:56:59 +05:30
|
|
|
}
|