2018-10-11 15:37:39 +00:00
|
|
|
defmodule MobilizonWeb.AuthErrorHandler do
|
2018-01-14 16:56:50 +00:00
|
|
|
@moduledoc """
|
|
|
|
In case we have an auth error
|
|
|
|
"""
|
2017-12-09 13:58:37 +00:00
|
|
|
import Plug.Conn
|
|
|
|
|
|
|
|
def auth_error(conn, {type, _reason}, _opts) do
|
|
|
|
body = Poison.encode!(%{message: to_string(type)})
|
|
|
|
send_resp(conn, 401, body)
|
|
|
|
end
|
2018-01-14 16:56:50 +00:00
|
|
|
end
|