Skip to content

Commit

Permalink
Add server errors to response
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodivisi0n committed Oct 15, 2017
1 parent da792c3 commit 8eb89c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/api.go
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 8eb89c7

Please sign in to comment.