diff --git a/config/config.exs b/config/config.exs
index 64a560e..e3dbce5 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -9,6 +9,7 @@ import Config
config :kmxgit,
discord: "https://discord.gg/nUAr57YKsh",
+ discord_errors_channel: "938563631480725544",
ecto_repos: [Kmxgit.Repo],
footer: """
<a href="https://www.kmx.io/" target="_blank"><i class="fas fa-circle"></i> kmx.io</a>
diff --git a/lib/discord.ex b/lib/discord.ex
new file mode 100644
index 0000000..caae729
--- /dev/null
+++ b/lib/discord.ex
@@ -0,0 +1,10 @@
+defmodule Discord do
+
+ def error(params) do
+ channel = Application.get_env(:kmxgit, :discord_errors_channel)
+ url = "/channels/#{channel}/messages"
+ message = %{content: inspect(params)}
+ json = Jason.encode!(message)
+ HTTPoison.post url json [{"Content-Type", "application/json"}]
+ end
+end
diff --git a/lib/kmxgit_web/router.ex b/lib/kmxgit_web/router.ex
index c7f9a51..ce5c8fa 100644
--- a/lib/kmxgit_web/router.ex
+++ b/lib/kmxgit_web/router.ex
@@ -168,7 +168,7 @@ end
use Plug.ErrorHandler
@impl Plug.ErrorHandler
def handle_errors(conn, params) do
- IO.inspect(params)
+ Discord.error(params)
send_resp(conn, conn.status, "Error ! We have been notified, please retry later.")
end
end