1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const make_error_1 = require("make-error");
|
4 | const TS_ERROR_MESSAGE = 'TypeScript compiler encountered syntax errors while transpiling. Errors: ';
|
5 | class TypeScriptCompileError extends make_error_1.BaseError {
|
6 | constructor(message, options) {
|
7 | super(message);
|
8 | this.name = 'TypeScriptCompileError';
|
9 | this.options = options;
|
10 | Object.defineProperty(this, 'options', {
|
11 | enumerable: false,
|
12 | });
|
13 | }
|
14 | toObject() {
|
15 | return {
|
16 | message: this.message,
|
17 | name: this.name,
|
18 | stack: this.stack,
|
19 | };
|
20 | }
|
21 | }
|
22 | exports.default = TypeScriptCompileError;
|
23 | TypeScriptCompileError.fromError = (error) => {
|
24 | const message = [
|
25 | 'Failed to compile TypeScript: ',
|
26 | error.message.replace(TS_ERROR_MESSAGE, ''),
|
27 | ].join('');
|
28 | return new TypeScriptCompileError(message, error);
|
29 | };
|
30 |
|
\ | No newline at end of file |