1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.EmptyJsonFileError = void 0;
|
4 |
|
5 |
|
6 |
|
7 | class JsonFileError extends Error {
|
8 | constructor(message, cause, code, fileName) {
|
9 | let fullMessage = message;
|
10 | if (fileName) {
|
11 | fullMessage += `\n${cause ? '├' : '└'}─ File: ${fileName}`;
|
12 | }
|
13 | if (cause) {
|
14 | fullMessage += `\n└─ Cause: ${cause.name}: ${cause.message}`;
|
15 | }
|
16 | super(fullMessage);
|
17 | this.name = this.constructor.name;
|
18 | this.cause = cause;
|
19 | this.code = code;
|
20 | this.fileName = fileName;
|
21 | this.isJsonFileError = true;
|
22 | }
|
23 | }
|
24 | exports.default = JsonFileError;
|
25 | class EmptyJsonFileError extends JsonFileError {
|
26 | constructor(fileName) {
|
27 | super(`Cannot parse an empty JSON string`, undefined, 'EJSONEMPTY', fileName);
|
28 | }
|
29 | }
|
30 | exports.EmptyJsonFileError = EmptyJsonFileError;
|
31 |
|
\ | No newline at end of file |