chiya/lib/chiya_web/error.ex

13 lines
368 B
Elixir
Raw Normal View History

defmodule ChiyaWeb.Error do
2023-03-31 16:58:10 +02:00
import Plug.Conn, only: [put_status: 2]
import Phoenix.Controller, only: [put_view: 2, render: 3]
2023-03-31 16:58:10 +02:00
def render_error(conn, :not_found, assigns \\ []) do
conn
2023-07-07 10:21:24 +02:00
|> put_root_layout(html: {ChiyaWeb.Layouts, :root_error})
2023-07-07 10:10:22 +02:00
|> put_status(:not_found)
|> put_view(ChiyaWeb.ErrorHTML)
|> render("404.html", assigns)
end
2023-03-31 16:58:10 +02:00
end