File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -301,10 +301,18 @@ export class Etc extends AbstractEthLikeCoin {
301301 params : [ address , 'latest' ] ,
302302 id : 1 ,
303303 } ) ;
304- // throw if the result does not exist or the result is not a valid number
305- if ( ! result || ! result . result || isNaN ( result . result ) ) {
306- throw new Error ( `Could not obtain address balance for ${ address } from etc.network, got: ${ result . result } ` ) ;
304+
305+ // throw if the result object does not exist
306+ if ( ! result ) {
307+ throw new Error ( `Could not obtain address balance for ${ address } from etc.network, got: Empty object response` ) ;
308+ } else if ( result . error ) {
309+ // throw if result.error exists
310+ throw new Error ( `Could not obtain address balance for ${ address } from etc.network, got: ${ result . error } ` ) ;
311+ } else if ( ! result . result || isNaN ( result . result ) ) {
312+ // throw if the result.result is not a number
313+ throw new Error ( `Could not obtain address balance for ${ address } from etc.network, got: Incorrect Balance Hex` ) ;
307314 }
315+
308316 const nativeBalanceHex = result . result ;
309317 return new optionalDeps . ethUtil . BN ( nativeBalanceHex . slice ( 2 ) , 16 ) ;
310318 }
You can’t perform that action at this time.
0 commit comments