Skip to content

Commit 45b1d7f

Browse files
committed
placeholder
1 parent f9ae3ad commit 45b1d7f

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

lib/sentry/phoenix_endpoint.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
defmodule Sentry.Phoenix.Endpoint do
2+
@moduledoc """
3+
Provides basic functionality to handle errors in a Phoenix Endpoint. Errors occurring within a Phoenix request before it reaches the Router will not be captured by `Sentry.Plug` due to the internal workings of Phoenix.
4+
5+
For more information, see https://github.com/getsentry/sentry-elixir/issues/229.
6+
7+
8+
#### Usage
9+
10+
Add the following to your endpoint.ex, below `use Phoenix.Endpoint, otp_app: :my_app`
11+
12+
use Sentry.Phoenix.Endpoint
13+
14+
"""
215
defmacro __using__(_opts) do
316
quote do
417
@before_compile Sentry.Phoenix.Endpoint

lib/sentry/plug.ex

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,14 @@ if Code.ensure_loaded?(Plug) do
148148

149149
@spec build_request_interface_data(Plug.Conn.t(), keyword()) :: map()
150150
def build_request_interface_data(%Plug.Conn{} = conn, opts) do
151-
body_scrubber = Keyword.get(opts, :body_scrubber)
152-
header_scrubber = Keyword.get(opts, :header_scrubber)
153-
cookie_scrubber = Keyword.get(opts, :cookie_scrubber)
151+
body_scrubber = Keyword.get(opts, :body_scrubber, {__MODULE__, :default_body_scrubber})
152+
153+
header_scrubber =
154+
Keyword.get(opts, :header_scrubber, {__MODULE__, :default_header_scrubber})
155+
156+
cookie_scrubber =
157+
Keyword.get(opts, :cookie_scrubber, {__MODULE__, :default_cookie_scrubber})
158+
154159
request_id = Keyword.get(opts, :request_id_header) || @default_plug_request_id_header
155160

156161
conn =

0 commit comments

Comments
 (0)