Merge pull request #343 from prometheus/beorn7/http

Fix error reporting bug
This commit is contained in:
Björn Rabenstein 2017-08-31 15:19:02 +02:00 committed by GitHub
commit 967789050b
1 changed files with 1 additions and 1 deletions

View File

@ -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()