@lwrjs/diagnostics 0.22.13 → 0.23.0

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.
@@ -41,6 +41,9 @@ var DEBUG = "debug";
41
41
  var INFO = "info";
42
42
  var WARN = "warn";
43
43
  var ERROR = "error";
44
+ function isAggregateLikeError(error) {
45
+ return error instanceof Error && typeof error === "object" && error !== null && "errors" in error && Array.isArray(error.errors);
46
+ }
44
47
  var options = {};
45
48
  var DUPES = new Set();
46
49
  function isLevelEnabled(level) {
@@ -108,7 +111,7 @@ var stringifyError = (error, count = 0) => {
108
111
  diagnostics: error.diagnostics,
109
112
  stack: error.stack
110
113
  });
111
- } else if (error instanceof AggregateError) {
114
+ } else if (isAggregateLikeError(error)) {
112
115
  const childErrors = error.errors.reduce((msg, e) => msg += `
113
116
  ${stringifyError(e)}`, "");
114
117
  return (decodeMessage(error.message) || error.name) + childErrors;
@@ -6,6 +6,13 @@ export const DEBUG = 'debug';
6
6
  export const INFO = 'info';
7
7
  export const WARN = 'warn';
8
8
  export const ERROR = 'error';
9
+ function isAggregateLikeError(error) {
10
+ return (error instanceof Error &&
11
+ typeof error === 'object' &&
12
+ error !== null &&
13
+ 'errors' in error &&
14
+ Array.isArray(error.errors));
15
+ }
9
16
  let options = {};
10
17
  const DUPES = new Set();
11
18
  function isLevelEnabled(level) {
@@ -80,7 +87,7 @@ export const stringifyError = (error, count = 0) => {
80
87
  stack: error.stack,
81
88
  });
82
89
  }
83
- else if (error instanceof AggregateError) {
90
+ else if (isAggregateLikeError(error)) {
84
91
  const childErrors = error.errors.reduce((msg, e) => (msg += `\n${stringifyError(e)}`), '');
85
92
  return (decodeMessage(error.message) || error.name) + childErrors;
86
93
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.22.13",
7
+ "version": "0.23.0",
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.22.13",
38
+ "@lwrjs/types": "0.23.0",
39
39
  "jest": "29.7.0",
40
40
  "ts-jest": "^29.2.6",
41
41
  "typescript": "5.0.4"
@@ -46,5 +46,5 @@
46
46
  "volta": {
47
47
  "extends": "../../../package.json"
48
48
  },
49
- "gitHead": "0696ace9a947340156151fba686a029fbc7466bf"
49
+ "gitHead": "5de81558aa52fc9593a386d9f6d82532c61cd4c1"
50
50
  }