File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
main/java/io/sentry/transport
test/java/io/sentry/transport Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -309,12 +309,14 @@ public void run() {
309309
310310 options .getLogger ().log (SentryLevel .ERROR , message );
311311
312- // ignore e.g. 429 as we're not the ones actively dropping
313- if (result .getResponseCode () >= 400 && result .getResponseCode () != 429 ) {
312+ if (result .getResponseCode () >= 400 ) {
314313 envelopeCache .discard (envelope );
315- options
316- .getClientReportRecorder ()
317- .recordLostEnvelope (DiscardReason .NETWORK_ERROR , envelopeWithClientReport );
314+ // ignore e.g. 429 as we're not the ones actively dropping
315+ if (result .getResponseCode () != 429 ) {
316+ options
317+ .getClientReportRecorder ()
318+ .recordLostEnvelope (DiscardReason .NETWORK_ERROR , envelopeWithClientReport );
319+ }
318320 }
319321
320322 throw new IllegalStateException (message );
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ class AsyncHttpTransportTest {
157157 }
158158
159159 @Test
160- fun `stores envelope after unsuccessful send 429` () {
160+ fun `discards envelope after unsuccessful send 429` () {
161161 // given
162162 val envelope = SentryEnvelope .from(fixture.sentryOptions.serializer, createSession(), null )
163163 whenever(fixture.transportGate.isConnected).thenReturn(true )
@@ -180,7 +180,7 @@ class AsyncHttpTransportTest {
180180 order.verify(fixture.sentryOptions.envelopeDiskCache).storeEnvelope(eq(envelope), anyOrNull())
181181
182182 order.verify(fixture.connection).send(eq(envelope))
183- verify(fixture.sentryOptions.envelopeDiskCache, never()) .discard(any( ))
183+ order. verify(fixture.sentryOptions.envelopeDiskCache) .discard(eq(envelope ))
184184 }
185185
186186 @Test
You can’t perform that action at this time.
0 commit comments