File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import type {
55import { isPlainObject } from '@metamask/utils' ;
66import safeStringify from 'fast-safe-stringify' ;
77
8- import type { DataWithOptionalCause } from './utils' ;
8+ import type { DataWithOptionalCause , OptionalDataWithOptionalCause } from './utils' ;
99import { serializeCause } from './utils' ;
1010
1111export type { SerializedJsonRpcError } ;
@@ -16,7 +16,7 @@ export type { SerializedJsonRpcError };
1616 *
1717 * Permits any integer error code.
1818 */
19- export class JsonRpcError < Data extends DataWithOptionalCause > extends Error {
19+ export class JsonRpcError < Data extends OptionalDataWithOptionalCause > extends Error {
2020 public code : number ;
2121
2222 public data ?: Data ;
Original file line number Diff line number Diff line change @@ -29,6 +29,16 @@ export type DataWithOptionalCause =
2929 cause : unknown ;
3030 } ;
3131
32+ /**
33+ * A data object, that must be either:
34+ *
35+ * - A valid DataWithOptionalCause value.
36+ * - undefined.
37+ */
38+ export type OptionalDataWithOptionalCause =
39+ | undefined
40+ | DataWithOptionalCause ;
41+
3242const FALLBACK_ERROR_CODE = errorCodes . rpc . internal ;
3343const FALLBACK_MESSAGE =
3444 'Unspecified error message. This is a bug, please report it.' ;
You can’t perform that action at this time.
0 commit comments