File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ module.exports = {
4747 global : {
4848 branches : 94.31 ,
4949 functions : 94.11 ,
50- lines : 97.05 ,
51- statements : 97.05 ,
50+ lines : 97.11 ,
51+ statements : 97.11 ,
5252 } ,
5353 } ,
5454
Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ import {
55} from '@metamask/utils' ;
66import safeStringify from 'fast-safe-stringify' ;
77
8- import { DataWithOptionalCause , serializeCause } from './utils' ;
8+ import type {
9+ DataWithOptionalCause ,
10+ OptionalDataWithOptionalCause ,
11+ } from './utils' ;
12+ import { serializeCause } from './utils' ;
913
1014export type { SerializedJsonRpcError } ;
1115
@@ -15,7 +19,9 @@ export type { SerializedJsonRpcError };
1519 *
1620 * Permits any integer error code.
1721 */
18- export class JsonRpcError < T extends DataWithOptionalCause > extends Error {
22+ export class JsonRpcError <
23+ T extends OptionalDataWithOptionalCause ,
24+ > extends Error {
1925 public code : number ;
2026
2127 public data ?: T ;
Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ export type DataWithOptionalCause =
2727 cause : unknown ;
2828 } ;
2929
30+ /**
31+ * A data object, that must be either:
32+ *
33+ * - A valid DataWithOptionalCause value.
34+ * - undefined.
35+ */
36+ export type OptionalDataWithOptionalCause = undefined | DataWithOptionalCause ;
37+
3038const FALLBACK_ERROR_CODE = errorCodes . rpc . internal ;
3139const FALLBACK_MESSAGE =
3240 'Unspecified error message. This is a bug, please report it.' ;
You can’t perform that action at this time.
0 commit comments