feat: add some more detailed errors
All checks were successful
Build and Push Server / build-and-push (push) Successful in 2m54s
All checks were successful
Build and Push Server / build-and-push (push) Successful in 2m54s
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user