File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
packages/nextjs/src/utils Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff 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'];
104110type WrappedResponseEndMethod = AugmentedNextApiResponse [ 'end' ] ;
105111
106112function 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 ) {
You can’t perform that action at this time.
0 commit comments