View Source Sentry.PlugCapture (Sentry v9.0.0)

Provides basic functionality to handle and send errors occurring within Plug applications, including Phoenix.

It is intended for usage with Sentry.PlugContext.

usage

Usage

In a Phoenix application, it is important to use this module before the Phoenix endpoint itself. It should be added to your endpoint.ex file:

defmodule MyApp.Endpoint
  use Sentry.PlugCapture
  use Phoenix.Endpoint, otp_app: :my_app

  # ...
end

In a Plug application, it can be added below your router:

defmodule MyApp.PlugRouter do
  use Plug.Router
  use Sentry.PlugCapture

  # ...
end

use Sentry.PlugCapture

When you use Sentry.PlugCapture, Sentry overrides your Plug.call/2 callback and adds capturing errors and reporting to Sentry. You can still re-override that callback after use Sentry.PlugCapture if you need to.