From 0dcaf10564ada4cba73b5048c9a19a6930bef5cd Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar Date: Tue, 2 Jul 2019 15:55:29 +0530 Subject: [PATCH] Check error before wrapping Signed-off-by: Ganesh Vernekar --- block.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/block.go b/block.go index bd54e297c..6a8237f1f 100644 --- a/block.go +++ b/block.go @@ -453,7 +453,10 @@ func (r blockIndexReader) LabelValues(names ...string) (index.StringTuples, erro func (r blockIndexReader) Postings(name, value string) (index.Postings, error) { p, err := r.ir.Postings(name, value) - return p, errors.Wrapf(err, "block: %s", r.b.Meta().ULID) + if err != nil { + return p, errors.Wrapf(err, "block: %s", r.b.Meta().ULID) + } + return p, nil } func (r blockIndexReader) SortedPostings(p index.Postings) index.Postings { @@ -461,11 +464,10 @@ func (r blockIndexReader) SortedPostings(p index.Postings) index.Postings { } func (r blockIndexReader) Series(ref uint64, lset *labels.Labels, chks *[]chunks.Meta) error { - return errors.Wrapf( - r.ir.Series(ref, lset, chks), - "block: %s", - r.b.Meta().ULID, - ) + if err := r.ir.Series(ref, lset, chks); err != nil { + return errors.Wrapf(err, "block: %s", r.b.Meta().ULID) + } + return nil } func (r blockIndexReader) LabelIndices() ([][]string, error) {