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,19 +77,25 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
77
77
}
78
78
79
79
try {
80
+ console . log ( 'about to call handler' ) ;
80
81
return await origHandler ( req , res ) ; // Call original handler
81
82
} catch ( e ) {
83
+ console . log ( 'in catch right after calling handler' ) ;
84
+
82
85
console . error ( e ) ;
83
86
84
87
if ( currentScope ) {
85
88
currentScope . addEventProcessor ( event => {
89
+ console . log ( 'in event processor adding exception mechanism' ) ;
86
90
addExceptionMechanism ( event , {
87
91
handled : false ,
88
92
} ) ;
89
93
return event ;
90
94
} ) ;
95
+ console . log ( 'about to capture the error' ) ;
91
96
captureException ( e ) ;
92
97
}
98
+ console . log ( 'about to call res.end() with the captured error' ) ;
93
99
( res as AugmentedNextApiResponse ) . __sentryCapturedError = e ;
94
100
res . end ( ) ;
95
101
}
@@ -103,7 +109,9 @@ type ResponseEndMethod = AugmentedNextApiResponse['end'];
103
109
type WrappedResponseEndMethod = AugmentedNextApiResponse [ 'end' ] ;
104
110
105
111
function wrapEndMethod ( origEnd : ResponseEndMethod ) : WrappedResponseEndMethod {
112
+ console . log ( 'wrapping end method' ) ;
106
113
return async function newEnd ( this : AugmentedNextApiResponse , ...args : unknown [ ] ) {
114
+ console . log ( 'in newEnd' ) ;
107
115
const { __sentryTransaction : transaction , __sentryCapturedError : capturedError } = this ;
108
116
109
117
if ( transaction ) {
You can’t perform that action at this time.
0 commit comments