bonfire-app/lib/error_reporting.ex
Mayel de Borniol 0ef85e77f9 auto-format
2022-09-12 16:34:14 +12:00

24 lines
442 B
Elixir

defmodule Bonfire.ErrorReporting do
@behaviour Plug
import Untangle
defmacro __using__(_) do
quote do
require Bonfire.Common.Extend
Bonfire.Common.Extend.use_if_enabled(Sentry.PlugCapture)
end
end
@impl true
def init(_opts) do
[]
end
@impl true
def call(conn, opts) do
if Bonfire.Common.Extend.module_enabled?(Sentry),
do: Sentry.PlugContext.call(conn, opts),
else: conn
end
end