From 8eb89c79c9200a21e91d8957b0256669e975a9dd Mon Sep 17 00:00:00 2001 From: Alexey Zhuchkov Date: Sun, 15 Oct 2017 13:37:47 +0300 Subject: [PATCH] Add server errors to response --- api/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.go b/api/api.go index 4d7a4c91..f8e609a3 100644 --- a/api/api.go +++ b/api/api.go @@ -177,7 +177,7 @@ func HandleJobRequest(cache job.JobCache, db job.JobDB) func(w http.ResponseWrit if r.Method == "DELETE" { err = j.Delete(cache, db) if err != nil { - w.WriteHeader(http.StatusInternalServerError) + errorEncodeJSON(err, http.StatusInternalServerError, w) } else { w.WriteHeader(http.StatusNoContent) } @@ -192,7 +192,7 @@ func HandleJobRequest(cache job.JobCache, db job.JobDB) func(w http.ResponseWrit func HandleDeleteAllJobs(cache job.JobCache, db job.JobDB) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { if err := job.DeleteAll(cache, db); err != nil { - w.WriteHeader(http.StatusInternalServerError) + errorEncodeJSON(err, http.StatusInternalServerError, w) } else { w.WriteHeader(http.StatusNoContent) }