ring-clojure / ring-json

Ring middleware for handling JSON
318 stars 47 forks source link

Return more details when request is malformed #73

Open piranha opened 6 days ago

piranha commented 6 days ago

Currently the only error client gets is "Malformed JSON in request body.", while Jackson's exceptions contain enough details to diagnose a problem (i.e. "Unrecognized token 'ture'").

I could not come up with a PR solving this w/o majorly reordering internals, since json-body-request indicates an error happening with an empty response. If you're interested in that, I can work on a PR given the idea of a change. :)

weavejester commented 2 days ago

This seems like a reasonable improvement.

piranha commented 1 day ago

This is what I ended up with, and I'm struggling to do the same here w/o changing json-body-request return type. And json-body-request is public... Not sure which approach would be the best to take here, any thoughts?