Open
Description
Description
Today, an error is only associated with the span that was active at the time captureException(err)
was called. This leads to interesting situations like the following:
function foo() {
startSpan({ name: "foo" }, () => { // <-- Error will be associated with this span, even though it was thrown in the "bar" span
try {
bar();
} catch (e) {
captureException(e);
}
});
}
function bar() {
startSpan({ name: "bar" }, () => {
throw new Error();
});
}
We could experiment with adding a try-catch to the startSpan
wrappers that writes a non-enumerable span ID to errors that pass through (if they didn't have one yet), which is then picked up and preferred by the error processing pipeline over the span ID that is on the scope.
Metadata
Metadata
Assignees
Labels
No labels