Skip to content

Commit fb0032e

Browse files
committed
do lots of console.logging
1 parent 91e0d1e commit fb0032e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/nextjs/src/utils/withSentry.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,25 @@ 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
handled: false,
8892
});
8993
return event;
9094
});
95+
console.log('about to capture the error');
9196
captureException(e);
9297
}
98+
console.log('about to call res.end() with the captured error');
9399
(res as AugmentedNextApiResponse).__sentryCapturedError = e;
94100
res.end();
95101
}
@@ -103,7 +109,9 @@ type ResponseEndMethod = AugmentedNextApiResponse['end'];
103109
type WrappedResponseEndMethod = AugmentedNextApiResponse['end'];
104110

105111
function wrapEndMethod(origEnd: ResponseEndMethod): WrappedResponseEndMethod {
112+
console.log('wrapping end method');
106113
return async function newEnd(this: AugmentedNextApiResponse, ...args: unknown[]) {
114+
console.log('in newEnd');
107115
const { __sentryTransaction: transaction, __sentryCapturedError: capturedError } = this;
108116

109117
if (transaction) {

0 commit comments

Comments
 (0)