From 2cb8df16e3c88cdbe20b320599894a84209df5ac Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 31 Aug 2017 15:10:58 +0200 Subject: [PATCH] Fix error reporting bug That's the same bug fixed in #342 (which is the deprecated code only replicated in the `prometheus` package until v0.10 is out). --- prometheus/promhttp/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus/promhttp/http.go b/prometheus/promhttp/http.go index 4c70a7a..2d67f24 100644 --- a/prometheus/promhttp/http.go +++ b/prometheus/promhttp/http.go @@ -128,7 +128,7 @@ func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler { closer.Close() } if lastErr != nil && buf.Len() == 0 { - http.Error(w, "No metrics encoded, last error:\n\n"+err.Error(), http.StatusInternalServerError) + http.Error(w, "No metrics encoded, last error:\n\n"+lastErr.Error(), http.StatusInternalServerError) return } header := w.Header()