File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -384,6 +384,8 @@ Raven.prototype = {
384
384
ex = ex1 ;
385
385
}
386
386
387
+ console . log ( ex . stack ) ;
388
+
387
389
// null exception name so `Error` isn't prefixed to msg
388
390
ex . name = null ;
389
391
@@ -1132,15 +1134,15 @@ Raven.prototype = {
1132
1134
1133
1135
// e.g. frames captured via captureMessage throw
1134
1136
var j ;
1135
- if ( options && options . trimHeadFrames ) {
1136
- for ( j = 0 ; j < options . trimHeadFrames && j < frames . length ; j ++ ) {
1137
+ if ( options && options . trimTailFrames ) {
1138
+ for ( j = 0 ; j < options . trimTailFrames && j < frames . length ; j ++ ) {
1137
1139
frames [ j ] . in_app = false ;
1138
1140
}
1139
1141
}
1140
1142
1141
1143
// e.g. try/catch (wrapper) frames
1142
- if ( options && options . trimTailFrames ) {
1143
- for ( j = options . trimTailFrames ; j < frames . length ; j ++ ) {
1144
+ if ( options && options . trimHeadFrames ) {
1145
+ for ( j = frames . length - options . trimHeadFrames ; j < frames . length ; j ++ ) {
1144
1146
frames [ j ] . in_app = false ;
1145
1147
}
1146
1148
}
Original file line number Diff line number Diff line change @@ -2027,6 +2027,29 @@ describe('Raven (public API)', function() {
2027
2027
} ) ;
2028
2028
} ) ;
2029
2029
2030
+ it ( 'should include a synthetic stacktrace if stacktrace:true is passed' , function ( ) {
2031
+ this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
2032
+ this . sinon . stub ( Raven , '_send' ) ;
2033
+
2034
+ function foo ( ) {
2035
+ Raven . captureMessage ( 'foo' , {
2036
+ stacktrace : true
2037
+ } ) ;
2038
+ }
2039
+
2040
+ foo ( ) ;
2041
+ var frames = Raven . _send . lastCall . args [ 0 ] . stacktrace . frames ;
2042
+
2043
+ // Raven.captureMessage
2044
+ var last = frames [ frames . length - 1 ] ;
2045
+ console . log ( last . function ) ;
2046
+ assert . isTrue ( / c a p t u r e M e s s a g e / . test ( last . function ) ) ; // loose equality check because differs per-browser
2047
+ assert . equal ( last . in_app , false ) ;
2048
+
2049
+ var secondLast = frames [ frames . length - 2 ] ;
2050
+ assert . equal ( secondLast . function , 'foo' ) ;
2051
+ assert . equal ( secondLast . in_app , true ) ;
2052
+ } ) ;
2030
2053
} ) ;
2031
2054
2032
2055
describe ( '.captureException' , function ( ) {
You can’t perform that action at this time.
0 commit comments