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
Last Post!
sekrett
On Elixir 1.7.4 I got this exact problem in umbrella project and fixed it by deleting _build folder. When I change debug_error flag and I restart the server I don’t see any file recompiled.
Popular in Questions
Other popular topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security










