@@ -265,7 +265,7 @@ Raven.prototype = {
265
265
return func . apply ( this , args ) ;
266
266
} catch ( e ) {
267
267
self . _ignoreNextOnError ( ) ;
268
- self . captureException ( e , options ) ;
268
+ self . captureException ( e , options , 1 ) ;
269
269
throw e ;
270
270
}
271
271
}
@@ -310,9 +310,11 @@ Raven.prototype = {
310
310
* @param {object } options A specific set of options for this error [optional]
311
311
* @return {Raven }
312
312
*/
313
- captureException : function ( ex , options ) {
313
+ captureException : function ( ex , options , skipframes ) {
314
+ skipframes = skipframes || 0 ;
315
+
314
316
// If not an Error is passed through, recall as a message instead
315
- if ( ! isError ( ex ) ) return this . captureMessage ( ex , options ) ;
317
+ if ( ! isError ( ex ) ) return this . captureMessage ( ex , options , skipframes + 1 ) ;
316
318
317
319
// Store the raw exception object for potential debugging and introspection
318
320
this . _lastCapturedException = ex ;
@@ -324,7 +326,7 @@ Raven.prototype = {
324
326
// report on.
325
327
try {
326
328
var stack = TraceKit . computeStackTrace ( ex ) ;
327
- this . _handleStackInfo ( stack , options ) ;
329
+ this . _handleStackInfo ( stack , options , skipframes ) ;
328
330
} catch ( ex1 ) {
329
331
if ( ex !== ex1 ) {
330
332
throw ex1 ;
@@ -341,7 +343,7 @@ Raven.prototype = {
341
343
* @param {object } options A specific set of options for this message [optional]
342
344
* @return {Raven }
343
345
*/
344
- captureMessage : function ( msg , options ) {
346
+ captureMessage : function ( msg , options , skipframes ) {
345
347
// config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an
346
348
// early call; we'll error on the side of logging anything called before configuration since it's
347
349
// probably something you should see:
@@ -1005,7 +1007,7 @@ Raven.prototype = {
1005
1007
}
1006
1008
} ,
1007
1009
1008
- _handleStackInfo : function ( stackInfo , options ) {
1010
+ _handleStackInfo : function ( stackInfo , options , skipframes ) {
1009
1011
var self = this ;
1010
1012
var frames = [ ] ;
1011
1013
@@ -1016,6 +1018,10 @@ Raven.prototype = {
1016
1018
frames . push ( frame ) ;
1017
1019
}
1018
1020
} ) ;
1021
+
1022
+ if ( skipframes ) {
1023
+ frames = frames . slice ( 0 , skipframes ) ;
1024
+ }
1019
1025
}
1020
1026
1021
1027
this . _triggerEvent ( 'handle' , {
0 commit comments