Hi,
I found that a usage of muuntaja.middleware/wrap-format is used in duct.middleware.web/format component without wrapping it into muuntaja.middleware/wrap-exception thus when a request body contains invalid JSON an exception is raised and couldn't be caught.
Quick and dirty fix could be like this:
(defmethod ig/init-key ::format [_ options]
(fn [a]
(mm/wrap-exception
(mm/wrap-format a (deep-merge mc/default-options options))
(fn [ex fmt request]
{:status 400
:headers {"Content-Type" "text/plain"}
:body (str "Malformed " format " request.")}))))
But I think the best would be to allow a developer to define its own handler via options.
What do you think?
Thanks for feedback.