defmodule Chess.Auth.ErrorHandler do
  @moduledoc false

  import Plug.Conn

  def auth_error(conn, {_type, _reason}, _opts) do
    conn
    |> Phoenix.Controller.put_flash(:info, "You must be logged in")
    |> Phoenix.Controller.redirect(to: "/")
    |> halt()
  end
end

defmodule Chess.Auth.ErrorHandler do
  @moduledoc false

  use ChessWeb, :controller

  import Plug.Conn

  def auth_error(conn, {_type, _reason}, _opts) do
    conn
    |> put_flash(:info, "You must be logged in")
    |> redirect(to: "/")
    |> halt()
  end
end

Make error handler a controller
Make error handler a controller

danbee/chess,danbee/chess,danbee/chess