File tree 1 file changed +8
-0
lines changed
packages/nextjs/src/utils 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -74,17 +74,22 @@ export const withSentry = (handler: NextApiHandler): WrappedNextApiHandler => {
74
74
}
75
75
76
76
try {
77
+ console . log ( 'about to call handler' ) ;
77
78
return await handler ( req , res ) ; // Call original handler
78
79
} catch ( e ) {
80
+ console . log ( 'in catch right after calling handler' ) ;
79
81
if ( currentScope ) {
80
82
currentScope . addEventProcessor ( event => {
83
+ console . log ( 'in event processor adding exception mechanism' ) ;
81
84
addExceptionMechanism ( event , {
82
85
handled : false ,
83
86
} ) ;
84
87
return event ;
85
88
} ) ;
89
+ console . log ( 'about to capture the error' ) ;
86
90
captureException ( e ) ;
87
91
}
92
+ console . log ( 'about to rethrow error' ) ;
88
93
throw e ;
89
94
}
90
95
} ) ;
@@ -97,7 +102,9 @@ type ResponseEndMethod = AugmentedResponse['end'];
97
102
type WrappedResponseEndMethod = AugmentedResponse [ 'end' ] ;
98
103
99
104
function wrapEndMethod ( origEnd : ResponseEndMethod ) : WrappedResponseEndMethod {
105
+ console . log ( 'wrapping end method' ) ;
100
106
return async function newEnd ( this : AugmentedResponse , ...args : unknown [ ] ) {
107
+ console . log ( 'in newEnd' ) ;
101
108
const transaction = this . __sentryTransaction ;
102
109
103
110
if ( transaction ) {
@@ -124,6 +131,7 @@ function wrapEndMethod(origEnd: ResponseEndMethod): WrappedResponseEndMethod {
124
131
logger . log ( `Error while flushing events:\n${ e } ` ) ;
125
132
}
126
133
134
+ console . log ( 'about to call origEnd' ) ;
127
135
return origEnd . call ( this , ...args ) ;
128
136
} ;
129
137
}
You can’t perform that action at this time.
0 commit comments