@lwrjs/diagnostics 0.17.2-alpha.9 → 0.17.2

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.
@@ -108,10 +108,13 @@ var stringifyError = (error, count = 0) => {
108
108
  diagnostics: error.diagnostics,
109
109
  stack: error.stack
110
110
  });
111
+ } else if (error instanceof AggregateError) {
112
+ const childErrors = error.errors.reduce((msg, e) => msg += `
113
+ ${stringifyError(e)}`, "");
114
+ return (decodeMessage(error.message) || error.name) + childErrors;
111
115
  } else if (error.message) {
112
116
  const message = error.message;
113
- const cause = error.cause && count < 1 ? `
114
- Cause: ${stringifyError(error.cause, 1)}` : "";
117
+ const cause = error.cause && count < 1 ? ` Cause: ${stringifyError(error.cause, 1)}` : "";
115
118
  return decodeMessage(message) + cause;
116
119
  } else if (typeof error === "string" || error instanceof String) {
117
120
  return decodeMessage(error);
@@ -4,45 +4,36 @@ export function isNodeError(error) {
4
4
  }
5
5
  // LWR-Node base error class from which all others extend
6
6
  export class LwrError extends Error {
7
- constructor() {
8
- super(...arguments);
9
- this.name = 'LwrError';
10
- }
7
+ name = 'LwrError';
11
8
  }
12
9
  // 500 - All errors which are instances of Error or LwrServerError will impact availability metrics
13
10
  export class LwrServerError extends LwrError {
14
- constructor() {
15
- super(...arguments);
16
- this.name = 'LwrServerError';
17
- }
11
+ name = 'LwrServerError';
18
12
  }
19
13
  // 500 - app layer does not affect availability
20
14
  export class LwrApplicationError extends LwrError {
21
- constructor() {
22
- super(...arguments);
23
- this.name = 'LwrApplicationError';
24
- }
15
+ name = 'LwrApplicationError';
25
16
  }
26
17
  // 400
27
18
  export class LwrInvalidError extends LwrError {
28
- constructor() {
29
- super(...arguments);
30
- this.name = 'LwrInvalidError';
31
- }
19
+ name = 'LwrInvalidError';
32
20
  }
33
21
  // 404
34
22
  export class LwrUnresolvableError extends LwrError {
23
+ name = 'LwrUnresolvableError';
24
+ type; // eg: "bundle", "asset"
35
25
  constructor(message, type) {
36
26
  super(message);
37
- this.name = 'LwrUnresolvableError';
38
27
  this.type = type;
39
28
  }
40
29
  }
41
30
  // 301, 302, 429, 503
42
31
  export class LwrStatusError extends LwrError {
32
+ name = 'LwrStatusError';
33
+ status;
34
+ headers; // for Location, Cache-Control, etc
43
35
  constructor(message, status, headers) {
44
36
  super(message);
45
- this.name = 'LwrStatusError';
46
37
  this.status = status;
47
38
  this.headers = headers;
48
39
  }
@@ -53,12 +44,10 @@ export class DiagnosticsError extends LwrError {
53
44
  this.diagnostics = diagnostics;
54
45
  this.name = 'LwrDiagnosticsError';
55
46
  }
47
+ diagnostics;
56
48
  }
57
49
  // fatal config validation issues
58
50
  export class LwrConfigError extends DiagnosticsError {
59
- constructor() {
60
- super(...arguments);
61
- this.name = 'LwrConfigError';
62
- }
51
+ name = 'LwrConfigError';
63
52
  }
64
53
  //# sourceMappingURL=errors.js.map
@@ -80,9 +80,13 @@ export const stringifyError = (error, count = 0) => {
80
80
  stack: error.stack,
81
81
  });
82
82
  }
83
+ else if (error instanceof AggregateError) {
84
+ const childErrors = error.errors.reduce((msg, e) => (msg += `\n${stringifyError(e)}`), '');
85
+ return (decodeMessage(error.message) || error.name) + childErrors;
86
+ }
83
87
  else if (error.message) {
84
88
  const message = error.message;
85
- const cause = error.cause && count < 1 ? `\nCause: ${stringifyError(error.cause, 1)}` : '';
89
+ const cause = error.cause && count < 1 ? ` Cause: ${stringifyError(error.cause, 1)}` : '';
86
90
  // Message may have been encoded to prevent XSS
87
91
  return decodeMessage(message) + cause;
88
92
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.17.2-alpha.9",
7
+ "version": "0.17.2",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -35,16 +35,16 @@
35
35
  "test": "jest"
36
36
  },
37
37
  "devDependencies": {
38
- "@lwrjs/types": "0.17.2-alpha.9",
39
- "jest": "^26.6.3",
40
- "ts-jest": "^26.5.6",
38
+ "@lwrjs/types": "0.17.2",
39
+ "jest": "29.7.0",
40
+ "ts-jest": "^29.2.6",
41
41
  "typescript": "^4.9.5"
42
42
  },
43
43
  "engines": {
44
- "node": ">=18.0.0"
44
+ "node": ">=20.0.0"
45
45
  },
46
46
  "volta": {
47
47
  "extends": "../../../package.json"
48
48
  },
49
- "gitHead": "7ede5d04a97513b9869b13e66155bc4f3920bb99"
49
+ "gitHead": "d64d8888a28da36c05e3d8d9baf51416551863a9"
50
50
  }