()
| 69 | }; |
| 70 | |
| 71 | const requestTask = (): PromiseLike<TransportMakeRequestResponse> => |
| 72 | makeRequest({ body: serializeEnvelope(filteredEnvelope) }).then( |
| 73 | response => { |
| 74 | // Handle 413 Content Too Large |
| 75 | // Loss of envelope content is expected so we record a send_error client report |
| 76 | // https://develop.sentry.dev/sdk/expected-features/#dealing-with-network-failures |
| 77 | if (response.statusCode === 413) { |
| 78 | DEBUG_BUILD && |
| 79 | debug.error( |
| 80 | 'Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.', |
| 81 | ); |
| 82 | recordEnvelopeLoss('send_error'); |
| 83 | return response; |
| 84 | } |
| 85 | |
| 86 | // We don't want to throw on NOK responses, but we want to at least log them |
| 87 | if ( |
| 88 | DEBUG_BUILD && |
| 89 | response.statusCode !== undefined && |
| 90 | (response.statusCode < 200 || response.statusCode >= 300) |
| 91 | ) { |
| 92 | debug.warn(`Sentry responded with status code ${response.statusCode} to sent event.`); |
| 93 | } |
| 94 | |
| 95 | rateLimits = updateRateLimits(rateLimits, response); |
| 96 | return response; |
| 97 | }, |
| 98 | error => { |
| 99 | recordEnvelopeLoss('network_error'); |
| 100 | DEBUG_BUILD && debug.error('Encountered error running transport request:', error); |
| 101 | throw error; |
| 102 | }, |
| 103 | ); |
| 104 | |
| 105 | return buffer.add(requestTask).then( |
| 106 | result => result, |
nothing calls this directly
no test coverage detected