Return custom json response with 400-Bad Request, upon invalid json request body

Switched to Phoenix and using the Custom Errors functionality
got it to work as required.

For the community in case any future finders, below is the link for it.

https://phoenixframework.readme.io/docs/custom-errors

Important : make sure you set debug_errors: to false in config/dev.exs , to be able to see the custom message instead of the html error.

Hope it helps someone.

1 Like