@@ -296,29 +296,31 @@ const _localVariablesSyncIntegration = ((
296
296
return ;
297
297
}
298
298
299
- const frameCount = exception . stacktrace ?. frames ?. length || 0 ;
299
+ // Filter out frames where the function name is `new Promise` since these are in the error.stack frames
300
+ // but do not appear in the debugger call frames
301
+ const frames = ( exception . stacktrace ?. frames || [ ] ) . filter ( frame => frame . function !== 'new Promise' ) ;
300
302
301
- for ( let i = 0 ; i < frameCount ; i ++ ) {
303
+ for ( let i = 0 ; i < frames . length ; i ++ ) {
302
304
// Sentry frames are in reverse order
303
- const frameIndex = frameCount - i - 1 ;
305
+ const frameIndex = frames . length - i - 1 ;
304
306
305
307
// Drop out if we run out of frames to match up
306
- if ( ! exception ?. stacktrace ?. frames ?. [ frameIndex ] || ! cachedFrame [ i ] ) {
308
+ if ( ! frames [ frameIndex ] || ! cachedFrame [ i ] ) {
307
309
break ;
308
310
}
309
311
310
312
if (
311
313
// We need to have vars to add
312
314
cachedFrame [ i ] . vars === undefined ||
313
315
// We're not interested in frames that are not in_app because the vars are not relevant
314
- exception . stacktrace . frames [ frameIndex ] . in_app === false ||
316
+ frames [ frameIndex ] . in_app === false ||
315
317
// The function names need to match
316
- ! functionNamesMatch ( exception . stacktrace . frames [ frameIndex ] . function , cachedFrame [ i ] . function )
318
+ ! functionNamesMatch ( frames [ frameIndex ] . function , cachedFrame [ i ] . function )
317
319
) {
318
320
continue ;
319
321
}
320
322
321
- exception . stacktrace . frames [ frameIndex ] . vars = cachedFrame [ i ] . vars ;
323
+ frames [ frameIndex ] . vars = cachedFrame [ i ] . vars ;
322
324
}
323
325
}
324
326
0 commit comments