From 986674a7902108acb5a863c20496aab03d4f147f Mon Sep 17 00:00:00 2001 From: Henri DF Date: Wed, 16 May 2018 08:18:15 -0700 Subject: [PATCH] Make some lexing errors more informative (#4167) Signed-off-by: Henri DF --- promql/parse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/promql/parse.go b/promql/parse.go index 79299a4c20..f370f78312 100644 --- a/promql/parse.go +++ b/promql/parse.go @@ -210,7 +210,7 @@ func (p *parser) parseSeriesDesc() (m labels.Labels, vals []sequenceValue, err e p.next() k = math.Float64frombits(value.StaleNaN) } else { - p.errorf("expected number or 'stale' in %s but got %s", ctx, t.desc()) + p.errorf("expected number or 'stale' in %s but got %s (value: %s)", ctx, t.desc(), p.peek()) } vals = append(vals, sequenceValue{ value: k, @@ -222,7 +222,7 @@ func (p *parser) parseSeriesDesc() (m labels.Labels, vals []sequenceValue, err e } else if t.typ == itemEOF { break } else if t.typ != itemADD && t.typ != itemSUB { - p.errorf("expected next value or relative expansion in %s but got %s", ctx, t.desc()) + p.errorf("expected next value or relative expansion in %s but got %s (value: %s)", ctx, t.desc(), p.peek()) } // Expand the repeated offsets into values.