2018-10-11 17:37:39 +02:00
|
|
|
defmodule MobilizonWeb.AuthErrorHandler do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
In case we have an auth error
|
|
|
|
"""
|
2017-12-09 14:58:37 +01: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 17:56:50 +01:00
|
|
|
end
|