Skip to content

Commit db4ec88

Browse files
rochdevtlhunter
authored andcommitted
fix error handling for synchronous exceptions
1 parent 64d54ac commit db4ec88

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/datadog-instrumentations/src/http2/client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ function createWrapRequest (authority, options) {
3333
const ctx = { headers, authority, options }
3434

3535
return startChannel.runStores(ctx, () => {
36-
const req = request.apply(this, arguments)
36+
try {
37+
const req = request.apply(this, arguments)
3738

38-
shimmer.wrap(req, 'emit', createWrapEmit(ctx))
39+
shimmer.wrap(req, 'emit', createWrapEmit(ctx))
3940

40-
try {
4141
return req
4242
} catch (e) {
4343
ctx.error = e

packages/dd-trace/src/plugins/tracing.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class TracingPlugin extends Plugin {
8787
const span = this.activeSpan
8888

8989
if (!span._spanContext._tags['error']) {
90+
// Errors may be wrapped in a context.
91+
error = (error && error.error) || error
9092
span.setTag('error', error || 1)
9193
}
9294
}

0 commit comments

Comments
 (0)