Skip to content

Fix errors in ErrorView

Alex Gleason requested to merge errorview-json-fix into develop

Yo dawg I heard you like errors... well the ErrorView itself was causing errors making it unable to send a response.


It turns out ErrorView couldn't render properly because of no function clause matching in Plug.Conn.resp/3

That function clause? is_binary(body)

Instead, a Map was being passed into the body. It should have been encoded by Jason first. I looked at the Conn, and it had format: "activity+json". It turns out Phoenix needs to know about this if it wants to render the error. It only knows about regular "json" so far.

The fix is simple: just tell Phoenix about "activity+json" by adding it to the config:

Merge request reports