shahryarjb
Phoenix custom error doesn't work
I have read phoenix documents and edited my code but it didn’t work for me.
my dev config :
config :trangell_html_site_web, TrangellHtmlSiteWeb.Endpoint,
http: [port: 9991],
debug_errors: false,
code_reloader: true,
check_origin: false,
watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin",
cd: Path.expand("../assets", __DIR__)]]
my ErrorView :
def render("404.html", _assigns) do
"Page not found"
end
def render("500.html", _assigns) do
"Server internal error"
end
def template_not_found(template, _assigns) do
Phoenix.Controller.status_message_from_template(template)
end
but it shows me :
How can I fix this ?
ref
https://hexdocs.pm/phoenix/errors.html
https://hexdocs.pm/phoenix/views.html#the-errorview
phoenix 1.3 || elixir v1.6.4
Most Liked
josevalim
What is your Elixir version? There is a bug in Elixir before v1.7 where a change of configuration inside the umbrella project was not applying in some cases. If you remove _build at the umbrella root, does the issue still persists?
shahryarjb
Hello, my elixir ver is v1.6.4, I removed my _build and I saw this which was fixed. thank you , I’ll update this soon to 1.7
LostKobrakai
If you want to do work in a render/2 call but still render a template in the end you can use render_template/2, which you can see in practice here: Phoenix.Template – Phoenix v1.3.4








