@lwrjs/diagnostics 0.12.2 → 0.13.0-alpha.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.
- package/build/cjs/logger.cjs +4 -2
- package/build/es/logger.d.ts +1 -1
- package/build/es/logger.js +3 -2
- package/package.json +3 -3
package/build/cjs/logger.cjs
CHANGED
|
@@ -101,7 +101,7 @@ ${additionalMessage}`);
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
var stringifyError = (error) => {
|
|
104
|
+
var stringifyError = (error, count = 0) => {
|
|
105
105
|
if (error instanceof import_errors.DiagnosticsError) {
|
|
106
106
|
return JSON.stringify({
|
|
107
107
|
message: decodeMessage(error.message),
|
|
@@ -110,7 +110,9 @@ var stringifyError = (error) => {
|
|
|
110
110
|
});
|
|
111
111
|
} else if (error.message) {
|
|
112
112
|
const message = error.message;
|
|
113
|
-
|
|
113
|
+
const cause = error.cause && count < 1 ? `
|
|
114
|
+
Cause: ${stringifyError(error.cause, 1)}` : "";
|
|
115
|
+
return decodeMessage(message) + cause;
|
|
114
116
|
} else if (typeof error === "string" || error instanceof String) {
|
|
115
117
|
return decodeMessage(error);
|
|
116
118
|
} else {
|
package/build/es/logger.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ type LoggerOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
declare function getLogLevel(): string;
|
|
12
12
|
declare function log(level: LEVEL, message: string, additionalInfo?: any): void;
|
|
13
|
-
export declare const stringifyError: (error: any) => string;
|
|
13
|
+
export declare const stringifyError: (error: any, count?: number) => string;
|
|
14
14
|
export type LogMetadata = {
|
|
15
15
|
message: string;
|
|
16
16
|
label: string;
|
package/build/es/logger.js
CHANGED
|
@@ -71,7 +71,7 @@ function log(level, message, additionalInfo) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
export const stringifyError = (error) => {
|
|
74
|
+
export const stringifyError = (error, count = 0) => {
|
|
75
75
|
if (error instanceof DiagnosticsError) {
|
|
76
76
|
return JSON.stringify({
|
|
77
77
|
// Message may have been encoded to prevent XSS
|
|
@@ -82,8 +82,9 @@ export const stringifyError = (error) => {
|
|
|
82
82
|
}
|
|
83
83
|
else if (error.message) {
|
|
84
84
|
const message = error.message;
|
|
85
|
+
const cause = error.cause && count < 1 ? `\nCause: ${stringifyError(error.cause, 1)}` : '';
|
|
85
86
|
// Message may have been encoded to prevent XSS
|
|
86
|
-
return decodeMessage(message);
|
|
87
|
+
return decodeMessage(message) + cause;
|
|
87
88
|
}
|
|
88
89
|
else if (typeof error === 'string' || error instanceof String) {
|
|
89
90
|
// Message may have been encoded to prevent XSS
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.13.0-alpha.1",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"test": "jest"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@lwrjs/types": "0.
|
|
38
|
+
"@lwrjs/types": "0.13.0-alpha.1",
|
|
39
39
|
"jest": "^26.6.3",
|
|
40
40
|
"ts-jest": "^26.5.6",
|
|
41
41
|
"typescript": "^4.9.5"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"volta": {
|
|
47
47
|
"extends": "../../../package.json"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1b7147d4db0dbc363f36529cd65374325f940c40"
|
|
50
50
|
}
|