Skip to content

Commit c994073

Browse files
committed
rename event_id_and_source to get_event_id_and_source
1 parent 0271df9 commit c994073

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ If you are in a non-Phoenix Plug application, add `Sentry.PlugCapture` at the to
5454

5555
#### Capturing User Feedback
5656

57-
If you would like to capture user feedback as described [here](https://docs.sentry.io/enriching-error-data/user-feedback), the `Sentry.last_event_id_and_source()` function can be used to see if Sentry has sent an event within the current Plug process, and the source of that event. `:plug` will be the source for events coming from `Sentry.PlugCapture`. The options described in the Sentry documentation linked above can be encoded into the response as well.
57+
If you would like to capture user feedback as described [here](https://docs.sentry.io/enriching-error-data/user-feedback), the `Sentry.get_last_event_id_and_source()` function can be used to see if Sentry has sent an event within the current Plug process, and the source of that event. `:plug` will be the source for events coming from `Sentry.PlugCapture`. The options described in the Sentry documentation linked above can be encoded into the response as well.
5858

5959
An example Phoenix application setup that wanted to display the user feedback form on 500 responses on requests accepting HTML could look like:
6060

6161
```elixir
6262
defmodule MyAppWeb.ErrorView do
6363
# ...
6464
def render("500.html", _assigns) do
65-
case Sentry.last_event_id_and_source() do
65+
case Sentry.get_last_event_id_and_source() do
6666
{event_id, :plug} when is_binary(event_id) ->
6767
opts =
6868
# can do %{eventId: event_id, title: "My custom title"}

lib/sentry.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ defmodule Sentry do
140140
Since it uses the process dictionary, it will only return the last event
141141
ID sent within the current process.
142142
"""
143-
@spec last_event_id_and_source() :: {String.t(), atom() | nil} | nil
144-
def last_event_id_and_source do
143+
@spec get_last_event_id_and_source() :: {String.t(), atom() | nil} | nil
144+
def get_last_event_id_and_source do
145145
Process.get(:sentry_last_event_id_and_source)
146146
end
147147

test/plug_capture_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ defmodule Sentry.PlugCaptureTest do
147147
end
148148
end)
149149

150-
{event_id, _} = Sentry.last_event_id_and_source()
150+
{event_id, _} = Sentry.get_last_event_id_and_source()
151151

152152
assert_received {:plug_conn, :sent}
153153
assert {500, _headers, body} = sent_resp(conn)
@@ -208,7 +208,7 @@ defmodule Sentry.PlugCaptureTest do
208208
Sentry.ExamplePlugApplication.call(conn, [])
209209
end)
210210

211-
{event_id, _} = Sentry.last_event_id_and_source()
211+
{event_id, _} = Sentry.get_last_event_id_and_source()
212212

213213
assert_received {:plug_conn, :sent}
214214
assert {500, _headers, body} = sent_resp(conn)

test/support/example_plug_application.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule Sentry.ExamplePlugApplication do
3232
end
3333

3434
def handle_errors(conn, %{kind: _kind, reason: _reason, stack: _stack}) do
35-
response = case Sentry.last_event_id_and_source() do
35+
response = case Sentry.get_last_event_id_and_source() do
3636
{event_id, :plug} ->
3737
opts =
3838
%{title: "Testing", eventId: event_id}

test/support/test_error_view.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Sentry.ErrorView do
22
import Phoenix.HTML, only: [sigil_E: 2, raw: 1]
33

44
def render(_, _) do
5-
case Sentry.last_event_id_and_source() do
5+
case Sentry.get_last_event_id_and_source() do
66
{event_id, :plug} ->
77
opts =
88
%{title: "Testing", eventId: event_id}

0 commit comments

Comments
 (0)