@@ -100,8 +100,7 @@ defmodule Sentry.Client do
100
100
client = Config . client ( )
101
101
102
102
# This is a "private" option, only really used in testing.
103
- request_retries =
104
- Application . get_env ( :sentry , :request_retries , Transport . default_retries ( ) )
103
+ request_retries = Application . get_env ( :sentry , :request_retries , Transport . default_retries ( ) )
105
104
106
105
client_report
107
106
|> Envelope . from_client_report ( )
@@ -115,6 +114,7 @@ defmodule Sentry.Client do
115
114
client = Keyword . get_lazy ( opts , :client , & Config . client / 0 )
116
115
sample_rate = Keyword . get_lazy ( opts , :sample_rate , & Config . sample_rate / 0 )
117
116
before_send = Keyword . get_lazy ( opts , :before_send , & Config . before_send / 0 )
117
+ after_send_event = Keyword . get_lazy ( opts , :after_send_event , & Config . after_send_event / 0 )
118
118
119
119
request_retries =
120
120
Keyword . get_lazy ( opts , :request_retries , fn ->
@@ -123,13 +123,9 @@ defmodule Sentry.Client do
123
123
124
124
with :ok <- sample_event ( sample_rate ) ,
125
125
{ :ok , % Transaction { } = transaction } <- maybe_call_before_send ( transaction , before_send ) do
126
- case encode_and_send ( transaction , result_type , client , request_retries ) do
127
- { :ok , id } ->
128
- { :ok , id }
129
-
130
- { :error , % ClientError { } = error } ->
131
- { :error , error }
132
- end
126
+ send_result = encode_and_send ( transaction , result_type , client , request_retries )
127
+ _ignored = maybe_call_after_send ( transaction , send_result , after_send_event )
128
+ send_result
133
129
else
134
130
:unsampled ->
135
131
ClientReport.Sender . record_discarded_events ( :sample_rate , [ transaction ] )
@@ -194,7 +190,7 @@ defmodule Sentry.Client do
194
190
"""
195
191
end
196
192
197
- defp maybe_call_after_send ( % Event { } = event , result , callback ) do
193
+ defp maybe_call_after_send ( event , result , callback ) do
198
194
message = ":after_send_event must be an anonymous function or a {module, function} tuple"
199
195
200
196
case callback do
0 commit comments