MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / requestTask

Function requestTask

packages/core/src/transports/base.ts:71–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 7

serializeEnvelopeFunction · 0.90
updateRateLimitsFunction · 0.90
recordEnvelopeLossFunction · 0.85
errorMethod · 0.65
warnMethod · 0.65
makeRequestFunction · 0.50
thenMethod · 0.45

Tested by

no test coverage detected