lint
Some checks failed
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/tag/lint Pipeline failed
ci/woodpecker/tag/release Pipeline was successful

This commit is contained in:
Mael G. 2024-05-11 18:49:57 +02:00
parent 8ab7522c55
commit ba9e9ab9ab

View file

@ -71,14 +71,18 @@ func errorHandler(w http.ResponseWriter, r *http.Request) {
generateInternalServerError(w, err) generateInternalServerError(w, err)
return return
} }
t.Execute(w, errorData) if err := t.Execute(w, errorData); err != nil {
log.Error(err)
}
} }
func generateInternalServerError(w http.ResponseWriter, err error) { func generateInternalServerError(w http.ResponseWriter, err error) {
log.Println(err) log.Println(err)
w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(`{"error": "Internal Server Error"}`)) if _, err := w.Write([]byte(`{"error": "Internal Server Error"}`)); err != nil {
log.Error(err)
}
} }
func headersHandler(w http.ResponseWriter, r *http.Request) { func headersHandler(w http.ResponseWriter, r *http.Request) {