lighthouse 10.3.0-dev.20230621 → 10.3.0-dev.20230622
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/core/lib/lh-error.d.ts +14 -2
- package/core/lib/lh-error.js +7 -1
- package/package.json +1 -1
package/core/lib/lh-error.d.ts
CHANGED
|
@@ -23,10 +23,22 @@ export type SerializedBaseError = {
|
|
|
23
23
|
stack?: string;
|
|
24
24
|
cause?: unknown;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* The {@link ErrorOptions } type wasn't added until es2022 (Node 16), so we recreate it here to support ts targets before es2022.
|
|
28
|
+
* TODO: Just use `ErrorOptions` if we can't support targets before es2022 in the docs test.
|
|
29
|
+
*/
|
|
30
|
+
export type LHErrorOptions = {
|
|
31
|
+
cause: unknown;
|
|
32
|
+
};
|
|
26
33
|
/**
|
|
27
34
|
* @typedef {{sentinel: '__LighthouseErrorSentinel', code: string, stack?: string, cause?: unknown, properties?: {[p: string]: string|undefined}}} SerializedLighthouseError
|
|
28
35
|
* @typedef {{sentinel: '__ErrorSentinel', message: string, code?: string, stack?: string, cause?: unknown}} SerializedBaseError
|
|
29
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* The {@link ErrorOptions} type wasn't added until es2022 (Node 16), so we recreate it here to support ts targets before es2022.
|
|
39
|
+
* TODO: Just use `ErrorOptions` if we can't support targets before es2022 in the docs test.
|
|
40
|
+
* @typedef {{cause: unknown}} LHErrorOptions
|
|
41
|
+
*/
|
|
30
42
|
export class LighthouseError extends Error {
|
|
31
43
|
/**
|
|
32
44
|
* @param {string} method
|
|
@@ -59,9 +71,9 @@ export class LighthouseError extends Error {
|
|
|
59
71
|
/**
|
|
60
72
|
* @param {LighthouseErrorDefinition} errorDefinition
|
|
61
73
|
* @param {Record<string, string|undefined>=} properties
|
|
62
|
-
* @param {
|
|
74
|
+
* @param {LHErrorOptions=} options
|
|
63
75
|
*/
|
|
64
|
-
constructor(errorDefinition: LighthouseErrorDefinition, properties?: Record<string, string | undefined> | undefined, options?:
|
|
76
|
+
constructor(errorDefinition: LighthouseErrorDefinition, properties?: Record<string, string | undefined> | undefined, options?: LHErrorOptions | undefined);
|
|
65
77
|
code: string;
|
|
66
78
|
friendlyMessage: import("../index.js").IcuMessage;
|
|
67
79
|
lhrRuntimeError: boolean;
|
package/core/lib/lh-error.js
CHANGED
|
@@ -111,11 +111,17 @@ const ERROR_SENTINEL = '__ErrorSentinel';
|
|
|
111
111
|
* @typedef {{sentinel: '__ErrorSentinel', message: string, code?: string, stack?: string, cause?: unknown}} SerializedBaseError
|
|
112
112
|
*/
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* The {@link ErrorOptions} type wasn't added until es2022 (Node 16), so we recreate it here to support ts targets before es2022.
|
|
116
|
+
* TODO: Just use `ErrorOptions` if we can't support targets before es2022 in the docs test.
|
|
117
|
+
* @typedef {{cause: unknown}} LHErrorOptions
|
|
118
|
+
*/
|
|
119
|
+
|
|
114
120
|
class LighthouseError extends Error {
|
|
115
121
|
/**
|
|
116
122
|
* @param {LighthouseErrorDefinition} errorDefinition
|
|
117
123
|
* @param {Record<string, string|undefined>=} properties
|
|
118
|
-
* @param {
|
|
124
|
+
* @param {LHErrorOptions=} options
|
|
119
125
|
*/
|
|
120
126
|
constructor(errorDefinition, properties, options) {
|
|
121
127
|
super(errorDefinition.code, options);
|
package/package.json
CHANGED