File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ import type {
55import  {  isPlainObject  }  from  '@metamask/utils' ; 
66import  safeStringify  from  'fast-safe-stringify' ; 
77
8- import  type  {  DataWithOptionalCause  }  from  './utils' ; 
8+ import  type  { 
9+   DataWithOptionalCause , 
10+   OptionalDataWithOptionalCause , 
11+ }  from  './utils' ; 
912import  {  serializeCause  }  from  './utils' ; 
1013
1114export  type  {  SerializedJsonRpcError  } ; 
@@ -16,7 +19,9 @@ export type { SerializedJsonRpcError };
1619 * 
1720 * Permits any integer error code. 
1821 */ 
19- export  class  JsonRpcError < Data  extends  DataWithOptionalCause >  extends  Error  { 
22+ export  class  JsonRpcError < 
23+   Data  extends  OptionalDataWithOptionalCause , 
24+ >  extends  Error  { 
2025  public  code : number ; 
2126
2227  public  data ?: Data ; 
Original file line number Diff line number Diff line change @@ -29,6 +29,14 @@ 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  =  undefined  |  DataWithOptionalCause ; 
39+ 
3240const  FALLBACK_ERROR_CODE  =  errorCodes . rpc . internal ; 
3341const  FALLBACK_MESSAGE  = 
3442  'Unspecified error message. This is a bug, please report it.' ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments