Skip to content

Commit

Permalink
Pass in mechanism processor to captureException scope
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Jan 16, 2023
1 parent 924850f commit 1835aae
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions packages/nextjs/src/edge/utils/edgeWrapperUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,22 @@ export function withEdgeWrapping<H extends EdgeRouteHandler>(
// store a seen flag on it.
const objectifiedErr = objectify(e);

currentScope?.addEventProcessor(event => {
addExceptionMechanism(event, {
type: 'instrument',
handled: false,
data: {
function: options.mechanismFunctionName,
},
});
return event;
});

span?.setStatus('internal_error');

captureException(objectifiedErr);
captureException(objectifiedErr, scope => {
scope.addEventProcessor(event => {
addExceptionMechanism(event, {
type: 'instrument',
handled: false,
data: {
function: options.mechanismFunctionName,
},
});
return event;
});

return scope;
});

throw objectifiedErr;
} finally {
Expand Down

0 comments on commit 1835aae

Please sign in to comment.