Skip to content

Commit

Permalink
fix error handling for synchronous exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rochdev authored and tlhunter committed Jun 26, 2023
1 parent f45054c commit 01df076
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/datadog-instrumentations/src/http2/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function createWrapRequest (authority, options) {
const ctx = { headers, authority, options }

return startChannel.runStores(ctx, () => {
const req = request.apply(this, arguments)
try {
const req = request.apply(this, arguments)

shimmer.wrap(req, 'emit', createWrapEmit(ctx))
shimmer.wrap(req, 'emit', createWrapEmit(ctx))

try {
return req
} catch (e) {
ctx.error = e
Expand Down
2 changes: 2 additions & 0 deletions packages/dd-trace/src/plugins/tracing.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class TracingPlugin extends Plugin {
const span = this.activeSpan

if (!span._spanContext._tags['error']) {
// Errors may be wrapped in a context.
error = (error && error.error) || error
span.setTag('error', error || 1)
}
}
Expand Down

0 comments on commit 01df076

Please sign in to comment.