@@ -220,11 +220,21 @@ function _normalize(value: any): string {
220
220
throw new Error ( "Hmm..." ) ;
221
221
}
222
222
223
- function normalizeResult ( value : RunnerResult ) : { tag : string , value : any } {
223
+ function normalizeResult ( method : string , value : RunnerResult ) : { tag : string , value : any } {
224
224
225
225
if ( "error" in value ) {
226
226
const error = value . error ;
227
- return { tag : _normalize ( error ) , value : error } ;
227
+
228
+ let tag : string ;
229
+ if ( isError ( error , "CALL_EXCEPTION" ) ) {
230
+ tag = _normalize ( Object . assign ( { } , error , {
231
+ shortMessage : undefined , reason : undefined , info : undefined
232
+ } ) ) ;
233
+ } else {
234
+ tag = _normalize ( error )
235
+ }
236
+
237
+ return { tag, value : error } ;
228
238
}
229
239
230
240
const result = value . result ;
@@ -248,7 +258,6 @@ function checkQuorum(quorum: number, results: Array<TallyResult>): any | Error {
248
258
}
249
259
250
260
let best : null | { value : any , weight : number } = null ;
251
-
252
261
for ( const r of tally . values ( ) ) {
253
262
if ( r . weight >= quorum && ( ! best || r . weight > best . weight ) ) {
254
263
best = r ;
@@ -586,7 +595,7 @@ export class FallbackProvider extends AbstractProvider {
586
595
const results : Array < TallyResult > = [ ] ;
587
596
for ( const runner of running ) {
588
597
if ( runner . result != null ) {
589
- const { tag, value } = normalizeResult ( runner . result ) ;
598
+ const { tag, value } = normalizeResult ( req . method , runner . result ) ;
590
599
results . push ( { tag, value, weight : runner . config . weight } ) ;
591
600
}
592
601
}
@@ -716,9 +725,9 @@ export class FallbackProvider extends AbstractProvider {
716
725
const broadcasts = this . #configs. map ( async ( { provider, weight } , index ) => {
717
726
try {
718
727
const result = await provider . _perform ( req ) ;
719
- results [ index ] = Object . assign ( normalizeResult ( { result } ) , { weight } ) ;
728
+ results [ index ] = Object . assign ( normalizeResult ( req . method , { result } ) , { weight } ) ;
720
729
} catch ( error : any ) {
721
- results [ index ] = Object . assign ( normalizeResult ( { error } ) , { weight } ) ;
730
+ results [ index ] = Object . assign ( normalizeResult ( req . method , { error } ) , { weight } ) ;
722
731
}
723
732
} ) ;
724
733
0 commit comments