Skip to content

Commit 1194a1e

Browse files
authored
fix xhr errors throwing in sync mode (#762)
1 parent 452b531 commit 1194a1e

File tree

1 file changed

+8
-1
lines changed
  • packages/datadog-plugin-xmlhttprequest/src

1 file changed

+8
-1
lines changed

packages/datadog-plugin-xmlhttprequest/src/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ function createWrapSend (tracer, config) {
4848
this.addEventListener('load', () => span.setTag('http.status', this.status))
4949
this.addEventListener('loadend', () => span.finish())
5050

51-
return tracer.scope().bind(send, span).apply(this, arguments)
51+
try {
52+
return tracer.scope().bind(send, span).apply(this, arguments)
53+
} catch (e) {
54+
span.setTag('error', e)
55+
span.finish()
56+
57+
throw e
58+
}
5259
}
5360
}
5461
}

0 commit comments

Comments
 (0)