From 296a27d10624fa07b4fcb8c1964eefa6a0ba850d Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Tue, 27 Oct 2020 17:22:44 +0100 Subject: [PATCH] accounts/abi/bind: restore error functionality (#21743) * accounts/abi/bind: restore error functionality * Update accounts/abi/bind/base.go Co-authored-by: Guillaume Ballet Co-authored-by: Guillaume Ballet --- accounts/abi/bind/base.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go index 0216f6b544..9e6d898eaf 100644 --- a/accounts/abi/bind/base.go +++ b/accounts/abi/bind/base.go @@ -152,7 +152,10 @@ func (c *BoundContract) Call(opts *CallOpts, results *[]interface{}, method stri } } else { output, err = c.caller.CallContract(ctx, msg, opts.BlockNumber) - if err == nil && len(output) == 0 { + if err != nil { + return err + } + if len(output) == 0 { // Make sure we have a contract to operate on, and bail out otherwise. if code, err = c.caller.CodeAt(ctx, c.address, opts.BlockNumber); err != nil { return err