UNPKG

866 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6class MTError extends Error {
7 static getMessage(code, type, message) {
8 return `MT[${code}] ${type}: ${message}`;
9 }
10 constructor(code, type, message) {
11 const fullMessage = MTError.getMessage(code, type, message);
12 super(fullMessage);
13 this.code = code;
14 this.type = type;
15 }
16}
17
18exports.MTError = MTError;
19class ErrorBadResponse extends MTError {
20 constructor(url, originalError = null) {
21 super(406, 'NETWORK_BAD_RESPONSE', url);
22 if (originalError) this.originalError = originalError;
23 }
24}
25
26exports.ErrorBadResponse = ErrorBadResponse;
27class ErrorNotFound extends MTError {
28 constructor(err) {
29 super(404, 'REQUEST_FAILED', err.config.url);
30 // this.originalError = err
31 }
32}
33exports.ErrorNotFound = ErrorNotFound;
34//# sourceMappingURL=error.js.map
\No newline at end of file