Error 404.html

phoenix
testing
troubleshooting
#1

Hi there,

I want to access 401.html in Phoenix but it seems it is not a part of the project. I cannot find it in the folder. How could I change the content of the template? Or, for example, reach 404.html or even 500.html?

#2

:wave:

Would https://hexdocs.pm/phoenix/errors.html#content be of any use to you?

#3

Hi Hris,

Errors are handled in the module App.ErrorView (file error_view.ex) which by defaults prints the status message for the current error.
If you want to customise 401.html you just need to create a file 401.html.eex in templates/error/.

More informations here: https://hexdocs.pm/phoenix/errors.html

3 Likes
#4

Thank you for the answer. I thought there was another way without creating any other templates. This answer suits me.

1 Like
#5

Hi, is there a way to place the 404.html template and other error templates such that it is rendered like any other template from app.html.eex (assuming errors are not being caused by trying to render the app.html page itself)? Thanks.

2 Likes