@mcma/core 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare class McmaException extends Error {
|
|
2
2
|
message: string;
|
|
3
|
-
cause?:
|
|
3
|
+
cause?: Error;
|
|
4
4
|
context?: any;
|
|
5
|
-
|
|
5
|
+
originalStack: string;
|
|
6
|
+
constructor(message: string, cause?: Error, context?: any);
|
|
6
7
|
toString(includeDetails?: boolean): string;
|
|
7
8
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.McmaException = void 0;
|
|
4
|
-
const os_1 = require("os");
|
|
5
4
|
class McmaException extends Error {
|
|
6
5
|
constructor(message, cause, context) {
|
|
7
6
|
super(message);
|
|
@@ -10,6 +9,7 @@ class McmaException extends Error {
|
|
|
10
9
|
this.context = context;
|
|
11
10
|
this.cause = cause;
|
|
12
11
|
this.context = context;
|
|
12
|
+
this.originalStack = this.stack;
|
|
13
13
|
this.stack = this.toString(true);
|
|
14
14
|
}
|
|
15
15
|
toString(includeDetails = false) {
|
|
@@ -17,18 +17,21 @@ class McmaException extends Error {
|
|
|
17
17
|
let ret = "";
|
|
18
18
|
let c = this;
|
|
19
19
|
while (c) {
|
|
20
|
-
if (includeDetails && c.
|
|
20
|
+
if (includeDetails && c.originalStack) {
|
|
21
|
+
ret += c.originalStack;
|
|
22
|
+
}
|
|
23
|
+
else if (includeDetails && c.stack) {
|
|
21
24
|
ret += c.stack;
|
|
22
25
|
}
|
|
23
26
|
else {
|
|
24
27
|
ret += "Error: " + ((_a = c.message) !== null && _a !== void 0 ? _a : c);
|
|
25
28
|
}
|
|
26
29
|
if (includeDetails && c.context) {
|
|
27
|
-
ret +=
|
|
30
|
+
ret += "\nContext:\n" + JSON.stringify(c.context, null, 2);
|
|
28
31
|
}
|
|
29
32
|
c = c.cause;
|
|
30
33
|
if (c) {
|
|
31
|
-
ret +=
|
|
34
|
+
ret += "\nCaused by:\n";
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
return ret;
|