@@ -100,8 +100,7 @@ defmodule Sentry.Client do
100100 client = Config . client ( )
101101
102102 # 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 ( ) )
105104
106105 client_report
107106 |> Envelope . from_client_report ( )
@@ -115,6 +114,7 @@ defmodule Sentry.Client do
115114 client = Keyword . get_lazy ( opts , :client , & Config . client / 0 )
116115 sample_rate = Keyword . get_lazy ( opts , :sample_rate , & Config . sample_rate / 0 )
117116 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 )
118118
119119 request_retries =
120120 Keyword . get_lazy ( opts , :request_retries , fn ->
@@ -123,13 +123,9 @@ defmodule Sentry.Client do
123123
124124 with :ok <- sample_event ( sample_rate ) ,
125125 { :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
133129 else
134130 :unsampled ->
135131 ClientReport.Sender . record_discarded_events ( :sample_rate , [ transaction ] )
@@ -194,7 +190,7 @@ defmodule Sentry.Client do
194190 """
195191 end
196192
197- defp maybe_call_after_send ( % Event { } = event , result , callback ) do
193+ defp maybe_call_after_send ( event , result , callback ) do
198194 message = ":after_send_event must be an anonymous function or a {module, function} tuple"
199195
200196 case callback do
0 commit comments