mirror of
https://github.com/openfaas/faas.git
synced 2025-06-22 14:53:25 +00:00
Improve error message when unable to list functions
Related to: #1022 Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
@ -35,7 +35,7 @@ func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQuery
|
|||||||
recorder.Code,
|
recorder.Code,
|
||||||
string(upstreamBody))
|
string(upstreamBody))
|
||||||
|
|
||||||
http.Error(w, "Metrics hander: unexpected status code retrieving functions from backend", http.StatusInternalServerError)
|
http.Error(w, "Metrics handler: unexpected status code from provider listing functions", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,9 +44,9 @@ func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQuery
|
|||||||
err := json.Unmarshal(upstreamBody, &functions)
|
err := json.Unmarshal(upstreamBody, &functions)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Metrics upstream error: %s", err)
|
log.Printf("Metrics upstream error: %s, value: %s", err, string(upstreamBody))
|
||||||
|
|
||||||
http.Error(w, "Error parsing metrics from upstream provider/backend", http.StatusInternalServerError)
|
http.Error(w, "Unable to parse list of functions from provider", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQuery
|
|||||||
bytesOut, err := json.Marshal(functions)
|
bytesOut, err := json.Marshal(functions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error serializing functions: %s", err)
|
log.Printf("Error serializing functions: %s", err)
|
||||||
http.Error(w, "error writing response after adding metrics", http.StatusInternalServerError)
|
http.Error(w, "Error writing response after adding metrics", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user