Skip to content
Snippets Groups Projects
Commit 887c8042 authored by Alex Ellis (OpenFaaS Ltd)'s avatar Alex Ellis (OpenFaaS Ltd)
Browse files

Improve error message when unable to list functions


Related to: #1022

Signed-off-by: default avatarAlex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
parent 9da2ec24
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQuery ...@@ -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 ...@@ -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 ...@@ -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
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment