UNPKG

1.04 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.EmptyJsonFileError = void 0;
4/**
5 * Note that instances of this class do NOT pass `instanceof JsonFileError`.
6 */
7class 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}
24exports.default = JsonFileError;
25class EmptyJsonFileError extends JsonFileError {
26 constructor(fileName) {
27 super(`Cannot parse an empty JSON string`, undefined, 'EJSONEMPTY', fileName);
28 }
29}
30exports.EmptyJsonFileError = EmptyJsonFileError;
31//# sourceMappingURL=JsonFileError.js.map
\No newline at end of file