feat: add some more detailed errors
All checks were successful
Build and Push Server / build-and-push (push) Successful in 2m54s

This commit is contained in:
Max Richter
2025-10-31 19:32:36 +01:00
parent 4bfd2b9450
commit fd6aeb8a27

View File

@@ -63,7 +63,7 @@ func (h *Handler) post(w http.ResponseWriter, r *http.Request, target string) {
body, err := io.ReadAll(r.Body)
if err != nil {
writeError(w, http.StatusBadRequest, err)
writeError(w, http.StatusBadRequest, fmt.Errorf("failed to decode body: %w", err))
return
}
defer r.Body.Close()
@@ -90,7 +90,7 @@ func (h *Handler) post(w http.ResponseWriter, r *http.Request, target string) {
var data map[string]any
if err := json.Unmarshal(body, &data); err != nil {
writeError(w, http.StatusInternalServerError, err)
writeError(w, http.StatusInternalServerError, fmt.Errorf("failed to decode body: %w", err))
return
}