shahryarjb

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

josevalim

Creator of Elixir

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

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

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

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.

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement