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 @@ -363,6 +363,8 @@ Raven.prototype = {
363
363
ex = ex1 ;
364
364
}
365
365
366
+ console . log ( ex . stack ) ;
367
+
366
368
// null exception name so `Error` isn't prefixed to msg
367
369
ex . name = null ;
368
370
@@ -1084,15 +1086,15 @@ Raven.prototype = {
1084
1086
1085
1087
// e.g. frames captured via captureMessage throw
1086
1088
var j ;
1087
- if ( options && options . trimHeadFrames ) {
1088
- for ( j = 0 ; j < options . trimHeadFrames && j < frames . length ; j ++ ) {
1089
+ if ( options && options . trimTailFrames ) {
1090
+ for ( j = 0 ; j < options . trimTailFrames && j < frames . length ; j ++ ) {
1089
1091
frames [ j ] . in_app = false ;
1090
1092
}
1091
1093
}
1092
1094
1093
1095
// e.g. try/catch (wrapper) frames
1094
- if ( options && options . trimTailFrames ) {
1095
- for ( j = options . trimTailFrames ; j < frames . length ; j ++ ) {
1096
+ if ( options && options . trimHeadFrames ) {
1097
+ for ( j = frames . length - options . trimHeadFrames ; j < frames . length ; j ++ ) {
1096
1098
frames [ j ] . in_app = false ;
1097
1099
}
1098
1100
}
Original file line number Diff line number Diff line change @@ -1910,6 +1910,29 @@ describe('Raven (public API)', function() {
1910
1910
} ) ;
1911
1911
} ) ;
1912
1912
1913
+ it ( 'should include a synthetic stacktrace if stacktrace:true is passed' , function ( ) {
1914
+ this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
1915
+ this . sinon . stub ( Raven , '_send' ) ;
1916
+
1917
+ function foo ( ) {
1918
+ Raven . captureMessage ( 'foo' , {
1919
+ stacktrace : true
1920
+ } ) ;
1921
+ }
1922
+
1923
+ foo ( ) ;
1924
+ var frames = Raven . _send . lastCall . args [ 0 ] . stacktrace . frames ;
1925
+
1926
+ // Raven.captureMessage
1927
+ var last = frames [ frames . length - 1 ] ;
1928
+ console . log ( last . function ) ;
1929
+ 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
1930
+ assert . equal ( last . in_app , false ) ;
1931
+
1932
+ var secondLast = frames [ frames . length - 2 ] ;
1933
+ assert . equal ( secondLast . function , 'foo' ) ;
1934
+ assert . equal ( secondLast . in_app , true ) ;
1935
+ } ) ;
1913
1936
} ) ;
1914
1937
1915
1938
describe ( '.captureException' , function ( ) {
You can’t perform that action at this time.
0 commit comments