Skip to content

Commit fac5e58

Browse files
authored
fix: handle xhr responseText exception (#178)
1 parent cbc69b8 commit fac5e58

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/otel-web': patch
3+
---
4+
5+
fix: handle xhr responseText exception

packages/otel-web/src/HyperDXXMLHttpRequestInstrumentation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ export class HyperDXXMLHttpRequestInstrumentation extends XMLHttpRequestInstrume
6666
span,
6767
(header) => headers[header],
6868
);
69-
span.setAttribute('http.response.body', xhr.responseText);
69+
try {
70+
span.setAttribute('http.response.body', xhr.responseText);
71+
} catch (e) {
72+
// ignore (DOMException if responseType is not the empty string or "text")
73+
}
7074

7175
shimmer.unwrap(xhr, 'setRequestHeader');
7276
shimmer.unwrap(xhr, 'send');

0 commit comments

Comments
 (0)