Magik.TelegramNoti.send_conn_error
You're seeing just the function
send_conn_error
, go back to Magik.TelegramNoti module for more information.
Specs
send_conn_error(atom(), Plug.Conn.t(), map()) :: {:ok, map()} | {:error, map()}
Format and send error message to a Telegam conversation with data from a connection. This helper is used to send error from your phoenix router or controller.
From router
defmodule MyApp.Router do
use MyAppWeb, :router
use Plug.ErrorHandler
...
def handle_errors(conn, error) do
if conn.status >= 500 do
Magik.TelegramNoti.send_conn_error(:api, conn, error)
end
....
end
end
from controller
defmodule MyAppWeb.PageController do
...
def index(conn, params)do
try do
...
catch
error ->
Magik.TelegramNoti.send_conn_error(:api, conn, %{kind: :error, reason: error, stack: __STACKTRACE__})
# return your error
end
end
end