Skip to content

Commit 1835aae

Browse files
committed
Pass in mechanism processor to captureException scope
1 parent 924850f commit 1835aae

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

packages/nextjs/src/edge/utils/edgeWrapperUtils.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,22 @@ export function withEdgeWrapping<H extends EdgeRouteHandler>(
7777
// store a seen flag on it.
7878
const objectifiedErr = objectify(e);
7979

80-
currentScope?.addEventProcessor(event => {
81-
addExceptionMechanism(event, {
82-
type: 'instrument',
83-
handled: false,
84-
data: {
85-
function: options.mechanismFunctionName,
86-
},
87-
});
88-
return event;
89-
});
90-
9180
span?.setStatus('internal_error');
9281

93-
captureException(objectifiedErr);
82+
captureException(objectifiedErr, scope => {
83+
scope.addEventProcessor(event => {
84+
addExceptionMechanism(event, {
85+
type: 'instrument',
86+
handled: false,
87+
data: {
88+
function: options.mechanismFunctionName,
89+
},
90+
});
91+
return event;
92+
});
93+
94+
return scope;
95+
});
9496

9597
throw objectifiedErr;
9698
} finally {

0 commit comments

Comments
 (0)