File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,10 @@ module.exports = {
4545 // An object that configures minimum threshold enforcement for coverage results
4646 coverageThreshold : {
4747 global : {
48- branches : 92.64 ,
48+ branches : 93.05 ,
4949 functions : 94.44 ,
50- lines : 92.85 ,
51- statements : 92.85 ,
50+ lines : 92.96 ,
51+ statements : 92.96 ,
5252 } ,
5353 } ,
5454
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import type {
22 Json ,
33 JsonRpcError as SerializedJsonRpcError ,
44} from '@metamask/utils' ;
5- import { isPlainObject } from '@metamask/utils' ;
5+ import { hasProperty , isObject , isPlainObject } from '@metamask/utils' ;
66import safeStringify from 'fast-safe-stringify' ;
77
88import type { OptionalDataWithOptionalCause } from './utils' ;
@@ -19,6 +19,9 @@ export type { SerializedJsonRpcError };
1919export class JsonRpcError <
2020 Data extends OptionalDataWithOptionalCause ,
2121> extends Error {
22+ // This can be removed when tsconfig lib and/or target have changed to >=es2022
23+ public cause : OptionalDataWithOptionalCause ;
24+
2225 public code : number ;
2326
2427 public data ?: Data ;
@@ -36,6 +39,13 @@ export class JsonRpcError<
3639 this . code = code ;
3740 if ( data !== undefined ) {
3841 this . data = data ;
42+ if (
43+ isObject ( data ) &&
44+ hasProperty ( data , 'cause' ) &&
45+ isObject ( data . cause )
46+ ) {
47+ this . cause = data . cause ;
48+ }
3949 }
4050 }
4151
Original file line number Diff line number Diff line change 33 "esModuleInterop" : true ,
44 "exactOptionalPropertyTypes" : true ,
55 "forceConsistentCasingInFileNames" : true ,
6+ // Remove custom `cause` field from JsonRpcError when updating
67 "lib" : [" ES2020" ],
78 "module" : " CommonJS" ,
89 "moduleResolution" : " node" ,
You can’t perform that action at this time.
0 commit comments