Open LukasRychtecky opened 6 years ago
I think this is a good idea, though as you mention, the best way forward would be to allow developers to define their own handler through an option.
Do we know that an exception will only be raised if the content is malformed?
It's recommended by Muuntaja https://github.com/metosin/muuntaja/blob/8e59542c5e557467de2d0018610c0d0a38d01e87/src/clj/muuntaja/middleware.clj#L17 (it checks for a type of an exception).
Hi,
I found that a usage of
muuntaja.middleware/wrap-format
is used induct.middleware.web/format
component without wrapping it intomuuntaja.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:
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.