diff --git a/lib/discord.ex b/lib/discord.ex
index 04e65d6..c81f79c 100644
--- a/lib/discord.ex
+++ b/lib/discord.ex
@@ -1,7 +1,9 @@
defmodule Discord do
- def error(params) do
- url = Application.get_env(:kmxgit, :discord_errors_webhook)
+ def error(conn, params) do
+ uri = conn.request_uri
+ user = conn.assigns[:current_user]
+ webhook = Application.get_env(:kmxgit, :discord_errors_webhook)
reason = if (try do params.reason.message rescue _ -> nil end) do
type = params.reason.__struct__
"#{type}: #{params.reason.message}"
@@ -9,8 +11,8 @@ defmodule Discord do
inspect(params.reason)
end
stack = Stack.to_string(params.stack)
- message = %{content: "```#{params.kind} #{reason}\n\n#{stack}```"}
+ message = %{content: "#{uri}\n#{user.slug.slug}\n```#{params.kind} #{reason}\n\n#{stack}```"}
json = Jason.encode!(message)
- HTTPoison.post(url, json, [{"Content-Type", "application/json"}])
+ HTTPoison.post(webhook, json, [{"Content-Type", "application/json"}])
end
end