From e8167fee6804ba612ed0721b39d42a6b858094ed Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 1 Feb 2024 20:58:31 +0000 Subject: [PATCH] Use lint reco for errors.as --- util/rpcclient/rpcclient.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/rpcclient/rpcclient.go b/util/rpcclient/rpcclient.go index d88e6dfc36..dbc145d490 100644 --- a/util/rpcclient/rpcclient.go +++ b/util/rpcclient/rpcclient.go @@ -170,8 +170,9 @@ func (c *RpcClient) CallContext(ctx_in context.Context, result interface{}, meth "attempt", i, "args", limitedArgumentsMarshal{limit, args}, } - if da, ok := err.(rpc.DataError); ok { - logEntry = append(logEntry, "errorData", limitedMarshal{limit, da.ErrorData()}) + var dataErr rpc.DataError + if errors.As(err, &dataErr) { + logEntry = append(logEntry, "errorData", limitedMarshal{limit, dataErr.ErrorData()}) } logger("rpc response", logEntry...) if err == nil {