@@ -257,7 +257,7 @@ Raven.prototype = {
257
257
return func . apply ( this , args ) ;
258
258
} catch ( e ) {
259
259
self . _ignoreNextOnError ( ) ;
260
- self . captureException ( e , options ) ;
260
+ self . captureException ( e , options , 1 ) ;
261
261
throw e ;
262
262
}
263
263
}
@@ -302,9 +302,11 @@ Raven.prototype = {
302
302
* @param {object } options A specific set of options for this error [optional]
303
303
* @return {Raven }
304
304
*/
305
- captureException : function ( ex , options ) {
305
+ captureException : function ( ex , options , skipframes ) {
306
+ skipframes = skipframes || 0 ;
307
+
306
308
// If not an Error is passed through, recall as a message instead
307
- if ( ! isError ( ex ) ) return this . captureMessage ( ex , options ) ;
309
+ if ( ! isError ( ex ) ) return this . captureMessage ( ex , options , skipframes + 1 ) ;
308
310
309
311
// Store the raw exception object for potential debugging and introspection
310
312
this . _lastCapturedException = ex ;
@@ -316,7 +318,7 @@ Raven.prototype = {
316
318
// report on.
317
319
try {
318
320
var stack = TraceKit . computeStackTrace ( ex ) ;
319
- this . _handleStackInfo ( stack , options ) ;
321
+ this . _handleStackInfo ( stack , options , skipframes ) ;
320
322
} catch ( ex1 ) {
321
323
if ( ex !== ex1 ) {
322
324
throw ex1 ;
@@ -333,7 +335,7 @@ Raven.prototype = {
333
335
* @param {object } options A specific set of options for this message [optional]
334
336
* @return {Raven }
335
337
*/
336
- captureMessage : function ( msg , options ) {
338
+ captureMessage : function ( msg , options , skipframes ) {
337
339
// config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an
338
340
// early call; we'll error on the side of logging anything called before configuration since it's
339
341
// probably something you should see:
@@ -1010,7 +1012,7 @@ Raven.prototype = {
1010
1012
}
1011
1013
} ,
1012
1014
1013
- _handleStackInfo : function ( stackInfo , options ) {
1015
+ _handleStackInfo : function ( stackInfo , options , skipframes ) {
1014
1016
var self = this ;
1015
1017
var frames = [ ] ;
1016
1018
@@ -1021,6 +1023,10 @@ Raven.prototype = {
1021
1023
frames . push ( frame ) ;
1022
1024
}
1023
1025
} ) ;
1026
+
1027
+ if ( skipframes ) {
1028
+ frames = frames . slice ( 0 , skipframes ) ;
1029
+ }
1024
1030
}
1025
1031
1026
1032
this . _triggerEvent ( 'handle' , {
0 commit comments