Skip to content

Commit 94861b7

Browse files
committed
do lots of console.logging
1 parent 95e7680 commit 94861b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/nextjs/src/utils/withSentry.ts

+8
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,26 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
7777
}
7878

7979
try {
80+
console.log('about to call handler');
8081
return await origHandler(req, res); // Call original handler
8182
} catch (e) {
83+
console.log('in catch right after calling handler');
84+
8285
console.error(e);
8386

8487
if (currentScope) {
8588
currentScope.addEventProcessor(event => {
89+
console.log('in event processor adding exception mechanism');
8690
addExceptionMechanism(event, {
8791
mechanism: 'withSentry',
8892
handled: false,
8993
});
9094
return event;
9195
});
96+
console.log('about to capture the error');
9297
captureException(e);
9398
}
99+
console.log('about to call res.end() with the captured error');
94100
(res as AugmentedNextApiResponse).__sentryCapturedError = e;
95101
res.end();
96102
}
@@ -104,7 +110,9 @@ type ResponseEndMethod = AugmentedNextApiResponse['end'];
104110
type WrappedResponseEndMethod = AugmentedNextApiResponse['end'];
105111

106112
function wrapEndMethod(origEnd: ResponseEndMethod): WrappedResponseEndMethod {
113+
console.log('wrapping end method');
107114
return async function newEnd(this: AugmentedNextApiResponse, ...args: unknown[]) {
115+
console.log('in newEnd');
108116
const { __sentryTransaction: transaction, __sentryCapturedError: capturedError } = this;
109117

110118
if (transaction) {

0 commit comments

Comments
 (0)