1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = function (d, b) {
|
4 | extendStatics = Object.setPrototypeOf ||
|
5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7 | return extendStatics(d, b);
|
8 | };
|
9 | return function (d, b) {
|
10 | if (typeof b !== "function" && b !== null)
|
11 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12 | extendStatics(d, b);
|
13 | function __() { this.constructor = d; }
|
14 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15 | };
|
16 | })();
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.TSError = exports.INSPECT_CUSTOM = void 0;
|
19 | var util_1 = require("util");
|
20 | var make_error_1 = require("make-error");
|
21 | var logger_1 = require("./logger");
|
22 | var messages_1 = require("./messages");
|
23 | var logger = logger_1.rootLogger.child({ namespace: 'TSError' });
|
24 |
|
25 |
|
26 |
|
27 | exports.INSPECT_CUSTOM = util_1.inspect.custom || 'inspect';
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | var TSError = (function (_super) {
|
34 | __extends(TSError, _super);
|
35 | function TSError(diagnosticText, diagnosticCodes) {
|
36 | var _this = _super.call(this, (0, messages_1.interpolate)("{{diagnostics}}" , {
|
37 | diagnostics: diagnosticText.trim(),
|
38 | })) || this;
|
39 | _this.diagnosticText = diagnosticText;
|
40 | _this.diagnosticCodes = diagnosticCodes;
|
41 | _this.name = 'TSError';
|
42 | logger.debug({ diagnosticCodes: diagnosticCodes, diagnosticText: diagnosticText }, 'created new TSError');
|
43 |
|
44 | Object.defineProperty(_this, 'stack', { value: '' });
|
45 | return _this;
|
46 | }
|
47 |
|
48 | TSError.prototype[exports.INSPECT_CUSTOM] = function () {
|
49 | return this.diagnosticText;
|
50 | };
|
51 | return TSError;
|
52 | }(make_error_1.BaseError));
|
53 | exports.TSError = TSError;
|