From a9c9a08b6a1e2e22039cc3b73645c762d267cde5 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sat, 20 Jan 2024 13:45:16 -0500 Subject: [PATCH] Don't stomp on outer error --- cmd/rqlite/query.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/rqlite/query.go b/cmd/rqlite/query.go index e8534f67..35e9a8db 100644 --- a/cmd/rqlite/query.go +++ b/cmd/rqlite/query.go @@ -92,18 +92,17 @@ func queryWithClient(ctx *cli.Context, client *cl.Client, timer bool, consistenc RawQuery: queryStr.Encode(), } - resp, err := client.Query(u) - var hcr error + resp, err := client.Query(u) if err != nil { // If the error is HostChangedError, it should be propagated back to the caller to handle // accordingly (change prompt display), but we should still assume that the request succeeded on some // host and not treat it as an error. - err, ok := err.(*cl.HostChangedError) + innerErr, ok := err.(*cl.HostChangedError) if !ok { return err } - hcr = err + hcr = innerErr } response, err := io.ReadAll(resp.Body)