parent
06dfee5b57
commit
8a423b721d
@ -0,0 +1,10 @@
|
|||||||
|
defmodule LinkShortenerWeb.Auth.ErrorHandler do
|
||||||
|
import Plug.Conn
|
||||||
|
|
||||||
|
def auth_error(conn, {type, _reason}, _opts) do
|
||||||
|
body = Poison.encode!(%{error: to_string(type)})
|
||||||
|
conn
|
||||||
|
|> put_resp_content_type("application/json")
|
||||||
|
|> send_resp(401, body)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue