Skip to content

Commit

Permalink
feat: return 5xx on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Oct 30, 2021
1 parent f21fddf commit b1337e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ func Handler(w http.ResponseWriter, r *http.Request) {
data := GetAllData()
if data.err != nil {
log.Error().Err(data.err).Msg("Could not fetch some data")
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte("Error fetching data: " + data.err.Error()))
return
}

Expand Down

0 comments on commit b1337e8

Please sign in to comment.