From 31b2a63ee23098fbd0151ef93020bd1cac093afe Mon Sep 17 00:00:00 2001 From: "loki-gh-app[bot]" <160051081+loki-gh-app[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:09:33 -0300 Subject: [PATCH] fix: logcli: Check for errors before checking for `exists` when fetching data (backport k227) (#14906) Co-authored-by: Dylan Guedes --- pkg/logcli/query/query.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/logcli/query/query.go b/pkg/logcli/query/query.go index 804d697380df5..cb693a0125139 100644 --- a/pkg/logcli/query/query.go +++ b/pkg/logcli/query/query.go @@ -553,12 +553,12 @@ func LoadSchemaUsingObjectClient(oc chunk.ObjectClient, name string) (*config.Sc defer cancel() ok, err := oc.ObjectExists(ctx, name) - if !ok { - return nil, errNotExists - } if err != nil { return nil, err } + if !ok { + return nil, errNotExists + } rdr, _, err := oc.GetObject(ctx, name) if err != nil {