@@ -65,26 +65,26 @@ export function stripSentryFramesAndReverse(stack: ReadonlyArray<StackFrame>): S
65
65
return [ ] ;
66
66
}
67
67
68
- let localStack = stack . slice ( 0 , STACKTRACE_LIMIT ) ;
68
+ const localStack = stack . slice ( 0 , STACKTRACE_LIMIT ) ;
69
69
70
70
const lastFrameFunction = localStack [ localStack . length - 1 ] . function ;
71
- // If stack ends with one of our internal API calls, remove it (ends , meaning it's the bottom of the stack - aka top-most call)
71
+ // If stack starts with one of our API calls, remove it (starts , meaning it's the top of the stack - aka last call)
72
72
if ( lastFrameFunction && / s e n t r y W r a p p e d / . test ( lastFrameFunction ) ) {
73
73
localStack . pop ( ) ;
74
74
}
75
75
76
76
// Reversing in the middle of the procedure allows us to just pop the values off the stack
77
- localStack = localStack . reverse ( ) ;
77
+ localStack . reverse ( ) ;
78
78
79
79
const firstFrameFunction = localStack [ localStack . length - 1 ] . function ;
80
- // If stack starts with one of our API calls, remove it (starts , meaning it's the top of the stack - aka last call)
80
+ // If stack ends with one of our internal API calls, remove it (ends , meaning it's the bottom of the stack - aka top-most call)
81
81
if ( firstFrameFunction && / c a p t u r e M e s s a g e | c a p t u r e E x c e p t i o n / . test ( firstFrameFunction ) ) {
82
82
localStack . pop ( ) ;
83
83
}
84
84
85
85
return localStack . map ( frame => ( {
86
86
...frame ,
87
- filename : frame . filename || localStack [ 0 ] . filename ,
87
+ filename : frame . filename || localStack [ localStack . length - 1 ] . filename ,
88
88
function : frame . function || '?' ,
89
89
} ) ) ;
90
90
}
0 commit comments