mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 12:37:58 +01:00
16 lines
385 B
Elixir
16 lines
385 B
Elixir
defmodule PhilomenaWeb.NotFoundPlug do
|
|
alias Phoenix.Controller
|
|
alias Plug.Conn
|
|
|
|
def init([]), do: []
|
|
|
|
def call(conn), do: call(conn, nil)
|
|
|
|
def call(conn, _opts) do
|
|
conn
|
|
|> Controller.fetch_flash()
|
|
|> Controller.put_flash(:error, "Couldn't find what you were looking for!")
|
|
|> Controller.redirect(external: conn.assigns.referrer)
|
|
|> Conn.halt()
|
|
end
|
|
end
|