How to override errors in phoenix?

elixir, phoenix-framework

Solution

You need to customize `MyApp.ErrorView`. Phoenix generates this file for you in web/views/error_view.ex. The default content of the template can be found on Github.

Also see the docs on custom errors, although they seem to be a bit outdated because they instruct you to use `MyApp.ErrorsView` (plural), which was replaced with `MyApp.ErrorView`

Problem

I build restful api (json) on phoenix. And I did not need the support of html. How to override errors in phoenix? Example errors: - 500 - 404 when no route found and other.

Original source