@@ -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:
@@ -1016,7 +1018,7 @@ Raven.prototype = {
1016
1018
}
1017
1019
} ,
1018
1020
1019
- _handleStackInfo : function ( stackInfo , options ) {
1021
+ _handleStackInfo : function ( stackInfo , options , skipframes ) {
1020
1022
var self = this ;
1021
1023
var frames = [ ] ;
1022
1024
@@ -1027,6 +1029,10 @@ Raven.prototype = {
1027
1029
frames . push ( frame ) ;
1028
1030
}
1029
1031
} ) ;
1032
+
1033
+ if ( skipframes ) {
1034
+ frames = frames . slice ( 0 , skipframes ) ;
1035
+ }
1030
1036
}
1031
1037
1032
1038
this . _triggerEvent ( 'handle' , {
0 commit comments