Skip to content

Commit 5cb82e1

Browse files
[skip ci] Merge branch into staging-45
2 parents baf3818 + 5dc89f4 commit 5cb82e1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/core/src/browser/fetchObservable.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,15 @@ async function afterSend(
151151
if (responseBodyCondition !== ResponseBodyAction.IGNORE) {
152152
const clonedResponse = tryToClone(response)
153153
if (clonedResponse && clonedResponse.body) {
154-
const bytes = await readBytesFromStream(clonedResponse.body, {
155-
collectStreamBody: responseBodyCondition === ResponseBodyAction.COLLECT,
156-
})
157-
context.responseBody = bytes && new TextDecoder().decode(bytes)
154+
try {
155+
const bytes = await readBytesFromStream(clonedResponse.body, {
156+
collectStreamBody: responseBodyCondition === ResponseBodyAction.COLLECT,
157+
})
158+
context.responseBody = bytes && new TextDecoder().decode(bytes)
159+
} catch {
160+
// Ignore errors when reading the response body (e.g., stream aborted, network errors)
161+
// This is not critical and should not be reported as an SDK error
162+
}
158163
}
159164
}
160165

0 commit comments

Comments
 (0)