@metamask-previews/keyring-controller 25.0.0-preview-6bed60a6 → 25.0.0-preview-bbf1f2af
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/CHANGELOG.md +4 -0
- package/dist/KeyringController.cjs +63 -58
- package/dist/KeyringController.cjs.map +1 -1
- package/dist/KeyringController.d.cts.map +1 -1
- package/dist/KeyringController.d.mts.map +1 -1
- package/dist/KeyringController.mjs +67 -62
- package/dist/KeyringController.mjs.map +1 -1
- package/dist/index.cjs +0 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/errors.cjs +0 -83
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -70
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.mts +0 -70
- package/dist/errors.d.mts.map +0 -1
- package/dist/errors.mjs +0 -79
- package/dist/errors.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./KeyringController.cjs"), exports);
|
|
18
|
-
__exportStar(require("./errors.cjs"), exports);
|
|
19
18
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAoC
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAoC","sourcesContent":["export * from './KeyringController';\nexport type * from './types';\n"]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B"}
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B"}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC","sourcesContent":["export * from './KeyringController';\nexport type * from './types';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/keyring-controller",
|
|
3
|
-
"version": "25.0.0-preview-
|
|
3
|
+
"version": "25.0.0-preview-bbf1f2af",
|
|
4
4
|
"description": "Stores identities seen in the wallet and manages interactions such as signing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@metamask/keyring-api": "^21.0.0",
|
|
58
58
|
"@metamask/keyring-internal-api": "^9.0.0",
|
|
59
59
|
"@metamask/messenger": "^0.3.0",
|
|
60
|
-
"@metamask/utils": "^11.
|
|
60
|
+
"@metamask/utils": "^11.9.0",
|
|
61
61
|
"async-mutex": "^0.5.0",
|
|
62
62
|
"ethereumjs-wallet": "^1.0.1",
|
|
63
63
|
"immer": "^9.0.6",
|
package/dist/errors.cjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KeyringControllerError = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Error class for KeyringController-related errors.
|
|
6
|
-
*
|
|
7
|
-
* This error class extends the standard Error class and supports:
|
|
8
|
-
* - Error chaining via the `cause` property (ES2022 standard)
|
|
9
|
-
* - Optional error codes for programmatic error handling
|
|
10
|
-
* - Additional context data for debugging
|
|
11
|
-
* - Backward compatibility with the legacy `originalError` property
|
|
12
|
-
*/
|
|
13
|
-
class KeyringControllerError extends Error {
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new KeyringControllerError.
|
|
16
|
-
*
|
|
17
|
-
* @param message - The error message.
|
|
18
|
-
* @param options - Error options or an Error object for backward compatibility.
|
|
19
|
-
*/
|
|
20
|
-
constructor(message, options) {
|
|
21
|
-
super(message);
|
|
22
|
-
this.name = 'KeyringControllerError';
|
|
23
|
-
// Support both new signature (options object) and legacy signature (Error as second param)
|
|
24
|
-
const cause = options instanceof Error ? options : options?.cause;
|
|
25
|
-
const code = options instanceof Error ? undefined : options?.code;
|
|
26
|
-
const data = options instanceof Error ? undefined : options?.data;
|
|
27
|
-
// Set cause property for error chaining (ES2022 standard)
|
|
28
|
-
if (cause) {
|
|
29
|
-
this.cause = cause;
|
|
30
|
-
// Maintain backward compatibility with originalError
|
|
31
|
-
this.originalError = cause;
|
|
32
|
-
}
|
|
33
|
-
// Set code and data if provided
|
|
34
|
-
if (code) {
|
|
35
|
-
this.code = code;
|
|
36
|
-
}
|
|
37
|
-
if (data) {
|
|
38
|
-
this.data = data;
|
|
39
|
-
}
|
|
40
|
-
// Ensure proper prototype chain for instanceof checks
|
|
41
|
-
Object.setPrototypeOf(this, KeyringControllerError.prototype);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Returns a JSON representation of the error.
|
|
45
|
-
* Useful for logging and error reporting.
|
|
46
|
-
*
|
|
47
|
-
* @returns JSON representation of the error.
|
|
48
|
-
*/
|
|
49
|
-
toJSON() {
|
|
50
|
-
return {
|
|
51
|
-
name: this.name,
|
|
52
|
-
message: this.message,
|
|
53
|
-
code: this.code,
|
|
54
|
-
data: this.data,
|
|
55
|
-
stack: this.stack,
|
|
56
|
-
cause: this.cause
|
|
57
|
-
? {
|
|
58
|
-
name: this.cause.name,
|
|
59
|
-
message: this.cause.message,
|
|
60
|
-
stack: this.cause.stack,
|
|
61
|
-
}
|
|
62
|
-
: undefined,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Returns a string representation of the error chain.
|
|
67
|
-
* Includes all chained errors for better debugging.
|
|
68
|
-
*
|
|
69
|
-
* @returns String representation of the error chain.
|
|
70
|
-
*/
|
|
71
|
-
toString() {
|
|
72
|
-
let result = `${this.name}: ${this.message}`;
|
|
73
|
-
if (this.code) {
|
|
74
|
-
result += ` [${this.code}]`;
|
|
75
|
-
}
|
|
76
|
-
if (this.cause) {
|
|
77
|
-
result += `\n Caused by: ${this.cause}`;
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.KeyringControllerError = KeyringControllerError;
|
|
83
|
-
//# sourceMappingURL=errors.cjs.map
|
package/dist/errors.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAqBA;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,KAAK;IAsB/C;;;;;OAKG;IACH,YACE,OAAe,EACf,OAA+C;QAE/C,KAAK,CAAC,OAAO,CAA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AAC,KAAK;iBACxB;gBACH,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACN,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QAE7C,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArGD,wDAqGC","sourcesContent":["/**\n * Options for creating a KeyringControllerError.\n */\nexport type KeyringControllerErrorOptions = {\n /**\n * The underlying error that caused this error (for error chaining).\n * Uses the standard Error.cause property (ES2022).\n */\n cause?: Error;\n /**\n * Optional error code for programmatic error handling.\n * This can be used to identify specific error types without string matching.\n */\n code?: string;\n /**\n * Additional context data associated with the error.\n * Useful for debugging and error reporting.\n */\n data?: Record<string, unknown>;\n};\n\n/**\n * Error class for KeyringController-related errors.\n *\n * This error class extends the standard Error class and supports:\n * - Error chaining via the `cause` property (ES2022 standard)\n * - Optional error codes for programmatic error handling\n * - Additional context data for debugging\n * - Backward compatibility with the legacy `originalError` property\n */\nexport class KeyringControllerError extends Error {\n /**\n * Optional error code for programmatic error handling.\n */\n code?: string;\n\n /**\n * Additional context data associated with the error.\n */\n data?: Record<string, unknown>;\n\n /**\n * The underlying error that caused this error (ES2022 standard).\n * This is set manually for compatibility with older TypeScript versions.\n */\n cause?: Error;\n\n /**\n * @deprecated Use `cause` instead. This property is maintained for backward compatibility.\n */\n originalError?: Error;\n\n /**\n * Creates a new KeyringControllerError.\n *\n * @param message - The error message.\n * @param options - Error options or an Error object for backward compatibility.\n */\n constructor(\n message: string,\n options?: KeyringControllerErrorOptions | Error,\n ) {\n super(message);\n this.name = 'KeyringControllerError';\n\n // Support both new signature (options object) and legacy signature (Error as second param)\n const cause = options instanceof Error ? options : options?.cause;\n const code = options instanceof Error ? undefined : options?.code;\n const data = options instanceof Error ? undefined : options?.data;\n\n // Set cause property for error chaining (ES2022 standard)\n if (cause) {\n this.cause = cause;\n // Maintain backward compatibility with originalError\n this.originalError = cause;\n }\n\n // Set code and data if provided\n if (code) {\n this.code = code;\n }\n if (data) {\n this.data = data;\n }\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, KeyringControllerError.prototype);\n }\n\n /**\n * Returns a JSON representation of the error.\n * Useful for logging and error reporting.\n *\n * @returns JSON representation of the error.\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n data: this.data,\n stack: this.stack,\n cause: this.cause\n ? {\n name: this.cause.name,\n message: this.cause.message,\n stack: this.cause.stack,\n }\n : undefined,\n };\n }\n\n /**\n * Returns a string representation of the error chain.\n * Includes all chained errors for better debugging.\n *\n * @returns String representation of the error chain.\n */\n toString(): string {\n let result = `${this.name}: ${this.message}`;\n\n if (this.code) {\n result += ` [${this.code}]`;\n }\n\n if (this.cause) {\n result += `\\n Caused by: ${this.cause}`;\n }\n\n return result;\n }\n}\n"]}
|
package/dist/errors.d.cts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for creating a KeyringControllerError.
|
|
3
|
-
*/
|
|
4
|
-
export type KeyringControllerErrorOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* The underlying error that caused this error (for error chaining).
|
|
7
|
-
* Uses the standard Error.cause property (ES2022).
|
|
8
|
-
*/
|
|
9
|
-
cause?: Error;
|
|
10
|
-
/**
|
|
11
|
-
* Optional error code for programmatic error handling.
|
|
12
|
-
* This can be used to identify specific error types without string matching.
|
|
13
|
-
*/
|
|
14
|
-
code?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Additional context data associated with the error.
|
|
17
|
-
* Useful for debugging and error reporting.
|
|
18
|
-
*/
|
|
19
|
-
data?: Record<string, unknown>;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Error class for KeyringController-related errors.
|
|
23
|
-
*
|
|
24
|
-
* This error class extends the standard Error class and supports:
|
|
25
|
-
* - Error chaining via the `cause` property (ES2022 standard)
|
|
26
|
-
* - Optional error codes for programmatic error handling
|
|
27
|
-
* - Additional context data for debugging
|
|
28
|
-
* - Backward compatibility with the legacy `originalError` property
|
|
29
|
-
*/
|
|
30
|
-
export declare class KeyringControllerError extends Error {
|
|
31
|
-
/**
|
|
32
|
-
* Optional error code for programmatic error handling.
|
|
33
|
-
*/
|
|
34
|
-
code?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Additional context data associated with the error.
|
|
37
|
-
*/
|
|
38
|
-
data?: Record<string, unknown>;
|
|
39
|
-
/**
|
|
40
|
-
* The underlying error that caused this error (ES2022 standard).
|
|
41
|
-
* This is set manually for compatibility with older TypeScript versions.
|
|
42
|
-
*/
|
|
43
|
-
cause?: Error;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated Use `cause` instead. This property is maintained for backward compatibility.
|
|
46
|
-
*/
|
|
47
|
-
originalError?: Error;
|
|
48
|
-
/**
|
|
49
|
-
* Creates a new KeyringControllerError.
|
|
50
|
-
*
|
|
51
|
-
* @param message - The error message.
|
|
52
|
-
* @param options - Error options or an Error object for backward compatibility.
|
|
53
|
-
*/
|
|
54
|
-
constructor(message: string, options?: KeyringControllerErrorOptions | Error);
|
|
55
|
-
/**
|
|
56
|
-
* Returns a JSON representation of the error.
|
|
57
|
-
* Useful for logging and error reporting.
|
|
58
|
-
*
|
|
59
|
-
* @returns JSON representation of the error.
|
|
60
|
-
*/
|
|
61
|
-
toJSON(): Record<string, unknown>;
|
|
62
|
-
/**
|
|
63
|
-
* Returns a string representation of the error chain.
|
|
64
|
-
* Includes all chained errors for better debugging.
|
|
65
|
-
*
|
|
66
|
-
* @returns String representation of the error chain.
|
|
67
|
-
*/
|
|
68
|
-
toString(): string;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=errors.d.cts.map
|
package/dist/errors.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.cts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IAEtB;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,6BAA6B,GAAG,KAAK;IA6BjD;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBjC;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;CAanB"}
|
package/dist/errors.d.mts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for creating a KeyringControllerError.
|
|
3
|
-
*/
|
|
4
|
-
export type KeyringControllerErrorOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* The underlying error that caused this error (for error chaining).
|
|
7
|
-
* Uses the standard Error.cause property (ES2022).
|
|
8
|
-
*/
|
|
9
|
-
cause?: Error;
|
|
10
|
-
/**
|
|
11
|
-
* Optional error code for programmatic error handling.
|
|
12
|
-
* This can be used to identify specific error types without string matching.
|
|
13
|
-
*/
|
|
14
|
-
code?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Additional context data associated with the error.
|
|
17
|
-
* Useful for debugging and error reporting.
|
|
18
|
-
*/
|
|
19
|
-
data?: Record<string, unknown>;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Error class for KeyringController-related errors.
|
|
23
|
-
*
|
|
24
|
-
* This error class extends the standard Error class and supports:
|
|
25
|
-
* - Error chaining via the `cause` property (ES2022 standard)
|
|
26
|
-
* - Optional error codes for programmatic error handling
|
|
27
|
-
* - Additional context data for debugging
|
|
28
|
-
* - Backward compatibility with the legacy `originalError` property
|
|
29
|
-
*/
|
|
30
|
-
export declare class KeyringControllerError extends Error {
|
|
31
|
-
/**
|
|
32
|
-
* Optional error code for programmatic error handling.
|
|
33
|
-
*/
|
|
34
|
-
code?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Additional context data associated with the error.
|
|
37
|
-
*/
|
|
38
|
-
data?: Record<string, unknown>;
|
|
39
|
-
/**
|
|
40
|
-
* The underlying error that caused this error (ES2022 standard).
|
|
41
|
-
* This is set manually for compatibility with older TypeScript versions.
|
|
42
|
-
*/
|
|
43
|
-
cause?: Error;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated Use `cause` instead. This property is maintained for backward compatibility.
|
|
46
|
-
*/
|
|
47
|
-
originalError?: Error;
|
|
48
|
-
/**
|
|
49
|
-
* Creates a new KeyringControllerError.
|
|
50
|
-
*
|
|
51
|
-
* @param message - The error message.
|
|
52
|
-
* @param options - Error options or an Error object for backward compatibility.
|
|
53
|
-
*/
|
|
54
|
-
constructor(message: string, options?: KeyringControllerErrorOptions | Error);
|
|
55
|
-
/**
|
|
56
|
-
* Returns a JSON representation of the error.
|
|
57
|
-
* Useful for logging and error reporting.
|
|
58
|
-
*
|
|
59
|
-
* @returns JSON representation of the error.
|
|
60
|
-
*/
|
|
61
|
-
toJSON(): Record<string, unknown>;
|
|
62
|
-
/**
|
|
63
|
-
* Returns a string representation of the error chain.
|
|
64
|
-
* Includes all chained errors for better debugging.
|
|
65
|
-
*
|
|
66
|
-
* @returns String representation of the error chain.
|
|
67
|
-
*/
|
|
68
|
-
toString(): string;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=errors.d.mts.map
|
package/dist/errors.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IAEtB;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,6BAA6B,GAAG,KAAK;IA6BjD;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBjC;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;CAanB"}
|
package/dist/errors.mjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error class for KeyringController-related errors.
|
|
3
|
-
*
|
|
4
|
-
* This error class extends the standard Error class and supports:
|
|
5
|
-
* - Error chaining via the `cause` property (ES2022 standard)
|
|
6
|
-
* - Optional error codes for programmatic error handling
|
|
7
|
-
* - Additional context data for debugging
|
|
8
|
-
* - Backward compatibility with the legacy `originalError` property
|
|
9
|
-
*/
|
|
10
|
-
export class KeyringControllerError extends Error {
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new KeyringControllerError.
|
|
13
|
-
*
|
|
14
|
-
* @param message - The error message.
|
|
15
|
-
* @param options - Error options or an Error object for backward compatibility.
|
|
16
|
-
*/
|
|
17
|
-
constructor(message, options) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.name = 'KeyringControllerError';
|
|
20
|
-
// Support both new signature (options object) and legacy signature (Error as second param)
|
|
21
|
-
const cause = options instanceof Error ? options : options?.cause;
|
|
22
|
-
const code = options instanceof Error ? undefined : options?.code;
|
|
23
|
-
const data = options instanceof Error ? undefined : options?.data;
|
|
24
|
-
// Set cause property for error chaining (ES2022 standard)
|
|
25
|
-
if (cause) {
|
|
26
|
-
this.cause = cause;
|
|
27
|
-
// Maintain backward compatibility with originalError
|
|
28
|
-
this.originalError = cause;
|
|
29
|
-
}
|
|
30
|
-
// Set code and data if provided
|
|
31
|
-
if (code) {
|
|
32
|
-
this.code = code;
|
|
33
|
-
}
|
|
34
|
-
if (data) {
|
|
35
|
-
this.data = data;
|
|
36
|
-
}
|
|
37
|
-
// Ensure proper prototype chain for instanceof checks
|
|
38
|
-
Object.setPrototypeOf(this, KeyringControllerError.prototype);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Returns a JSON representation of the error.
|
|
42
|
-
* Useful for logging and error reporting.
|
|
43
|
-
*
|
|
44
|
-
* @returns JSON representation of the error.
|
|
45
|
-
*/
|
|
46
|
-
toJSON() {
|
|
47
|
-
return {
|
|
48
|
-
name: this.name,
|
|
49
|
-
message: this.message,
|
|
50
|
-
code: this.code,
|
|
51
|
-
data: this.data,
|
|
52
|
-
stack: this.stack,
|
|
53
|
-
cause: this.cause
|
|
54
|
-
? {
|
|
55
|
-
name: this.cause.name,
|
|
56
|
-
message: this.cause.message,
|
|
57
|
-
stack: this.cause.stack,
|
|
58
|
-
}
|
|
59
|
-
: undefined,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Returns a string representation of the error chain.
|
|
64
|
-
* Includes all chained errors for better debugging.
|
|
65
|
-
*
|
|
66
|
-
* @returns String representation of the error chain.
|
|
67
|
-
*/
|
|
68
|
-
toString() {
|
|
69
|
-
let result = `${this.name}: ${this.message}`;
|
|
70
|
-
if (this.code) {
|
|
71
|
-
result += ` [${this.code}]`;
|
|
72
|
-
}
|
|
73
|
-
if (this.cause) {
|
|
74
|
-
result += `\n Caused by: ${this.cause}`;
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=errors.mjs.map
|
package/dist/errors.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAqBA;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAsB/C;;;;;OAKG;IACH,YACE,OAAe,EACf,OAA+C;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QAErC,2FAA2F;QAC3F,MAAM,KAAK,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;QAClE,MAAM,IAAI,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;QAClE,MAAM,IAAI,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;QAElE,0DAA0D;QAC1D,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,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* Options for creating a KeyringControllerError.\n */\nexport type KeyringControllerErrorOptions = {\n /**\n * The underlying error that caused this error (for error chaining).\n * Uses the standard Error.cause property (ES2022).\n */\n cause?: Error;\n /**\n * Optional error code for programmatic error handling.\n * This can be used to identify specific error types without string matching.\n */\n code?: string;\n /**\n * Additional context data associated with the error.\n * Useful for debugging and error reporting.\n */\n data?: Record<string, unknown>;\n};\n\n/**\n * Error class for KeyringController-related errors.\n *\n * This error class extends the standard Error class and supports:\n * - Error chaining via the `cause` property (ES2022 standard)\n * - Optional error codes for programmatic error handling\n * - Additional context data for debugging\n * - Backward compatibility with the legacy `originalError` property\n */\nexport class KeyringControllerError extends Error {\n /**\n * Optional error code for programmatic error handling.\n */\n code?: string;\n\n /**\n * Additional context data associated with the error.\n */\n data?: Record<string, unknown>;\n\n /**\n * The underlying error that caused this error (ES2022 standard).\n * This is set manually for compatibility with older TypeScript versions.\n */\n cause?: Error;\n\n /**\n * @deprecated Use `cause` instead. This property is maintained for backward compatibility.\n */\n originalError?: Error;\n\n /**\n * Creates a new KeyringControllerError.\n *\n * @param message - The error message.\n * @param options - Error options or an Error object for backward compatibility.\n */\n constructor(\n message: string,\n options?: KeyringControllerErrorOptions | Error,\n ) {\n super(message);\n this.name = 'KeyringControllerError';\n\n // Support both new signature (options object) and legacy signature (Error as second param)\n const cause = options instanceof Error ? options : options?.cause;\n const code = options instanceof Error ? undefined : options?.code;\n const data = options instanceof Error ? undefined : options?.data;\n\n // Set cause property for error chaining (ES2022 standard)\n if (cause) {\n this.cause = cause;\n // Maintain backward compatibility with originalError\n this.originalError = cause;\n }\n\n // Set code and data if provided\n if (code) {\n this.code = code;\n }\n if (data) {\n this.data = data;\n }\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, KeyringControllerError.prototype);\n }\n\n /**\n * Returns a JSON representation of the error.\n * Useful for logging and error reporting.\n *\n * @returns JSON representation of the error.\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n data: this.data,\n stack: this.stack,\n cause: this.cause\n ? {\n name: this.cause.name,\n message: this.cause.message,\n stack: this.cause.stack,\n }\n : undefined,\n };\n }\n\n /**\n * Returns a string representation of the error chain.\n * Includes all chained errors for better debugging.\n *\n * @returns String representation of the error chain.\n */\n toString(): string {\n let result = `${this.name}: ${this.message}`;\n\n if (this.code) {\n result += ` [${this.code}]`;\n }\n\n if (this.cause) {\n result += `\\n Caused by: ${this.cause}`;\n }\n\n return result;\n }\n}\n"]}
|