From dac2b690f5285d64cbca6011aea7c95fd7676f9b Mon Sep 17 00:00:00 2001 From: Makram Date: Tue, 16 Jul 2024 09:20:20 +0300 Subject: [PATCH] ocr2/plugins/ccip/internal/pricegetter: format correct error (#1195) ## Motivation We are formatting the wrong error in `fmt.Errorf`. This was actually the root cause of `errcheck` not correctly flagging `err` as unchecked prior to PR https://github.com/smartcontractkit/ccip/pull/1145/ ## Solution Format the correct error. --- core/services/ocr2/plugins/ccip/internal/pricegetter/evm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/internal/pricegetter/evm.go b/core/services/ocr2/plugins/ccip/internal/pricegetter/evm.go index 830d56cd3a..ed54428bd9 100644 --- a/core/services/ocr2/plugins/ccip/internal/pricegetter/evm.go +++ b/core/services/ocr2/plugins/ccip/internal/pricegetter/evm.go @@ -156,7 +156,7 @@ func (d *DynamicPriceGetter) performBatchCall(ctx context.Context, chainID uint6 v, err1 := rpclib.ParseOutput[uint8](res, 0) if err1 != nil { callSignature := batchCalls.decimalCalls[i].String() - return fmt.Errorf("parse contract output while calling %v on chain %d: %w", callSignature, chainID, err) + return fmt.Errorf("parse contract output while calling %v on chain %d: %w", callSignature, chainID, err1) } decimals = append(decimals, v) } @@ -167,7 +167,7 @@ func (d *DynamicPriceGetter) performBatchCall(ctx context.Context, chainID uint6 v, err1 := rpclib.ParseOutput[*big.Int](res, 1) if err1 != nil { callSignature := batchCalls.latestRoundDataCalls[i].String() - return fmt.Errorf("parse contract output while calling %v on chain %d: %w", callSignature, chainID, err) + return fmt.Errorf("parse contract output while calling %v on chain %d: %w", callSignature, chainID, err1) } latestRounds = append(latestRounds, v) }