1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | class 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 |
|
18 | exports.MTError = MTError;
|
19 | class ErrorBadResponse extends MTError {
|
20 | constructor(url, originalError = null) {
|
21 | super(406, 'NETWORK_BAD_RESPONSE', url);
|
22 | if (originalError) this.originalError = originalError;
|
23 | }
|
24 | }
|
25 |
|
26 | exports.ErrorBadResponse = ErrorBadResponse;
|
27 | class ErrorNotFound extends MTError {
|
28 | constructor(err) {
|
29 | super(404, 'REQUEST_FAILED', err.config.url);
|
30 | this.originalError = err;
|
31 | }
|
32 | }
|
33 | exports.ErrorNotFound = ErrorNotFound;
|
34 |
|
\ | No newline at end of file |