-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught exception when a request body is not valid e.g. JSON #8
Comments
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.
The text was updated successfully, but these errors were encountered: