I have a little doubt.
I currently have a standard phoenix framework project.
I want to add an error page on a route that does not exist.
Note:
http://localhost:4000/ < OK
http://localhost:4000/a < Custom route error.
http://localhost:4000/ab < Custom route error.
http://localhost:4000/abc < Custom route error.
How do I?
Remembering, deactivated debug_error
to debug_errors: false
1 Like
idi527
2
Have you looked at http://www.phoenixframework.org/docs/views#section-the-errorview?
Basically, you just replace default render/2
functions in ErrorView
with something like
def render("404.html", _assigns) do
render "not_found.html", %{}
end
def render("500.html", _assigns) do
render "internal.html", %{}
end
where "not_found.html"
is in templates/error/
as is "internal.html"
.
3 Likes