Skip to content

Commit b7e1679

Browse files
authored
Improve event callback docs (#922)
1 parent 97d0382 commit b7e1679

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/sentry.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ defmodule Sentry do
129129
`MyModule` could look like this:
130130
131131
defmodule MyModule do
132+
@spec before_send(Sentry.Event.t()) :: Sentry.Event.t()
132133
def before_send(event) do
133134
metadata = Map.new(Logger.metadata())
134135
%Sentry.Event{event | extra: Map.merge(event.extra, metadata)}
135136
end
136137
137-
def after_send_event(event, result) do
138+
@spec after_send(Sentry.Event.t(), {:ok, String.t()} | {:error, any()}) :: any()
139+
def after_send(event, result) do
138140
case result do
139141
{:ok, id} ->
140142
Logger.info("Successfully sent event!")
@@ -145,6 +147,8 @@ defmodule Sentry do
145147
end
146148
end
147149
150+
If the `before_send` callback returns `nil` or `false`, the event is not reported.
151+
148152
## Reporting Source Code
149153
150154
Sentry supports reporting the source code of (and around) the line that

0 commit comments

Comments
 (0)