@@ -241,6 +241,15 @@ export class ReplayContainer implements ReplayContainerInterface {
241
241
return this . _options ;
242
242
}
243
243
244
+ /** A wrapper to conditionally capture exceptions. */
245
+ public handleException ( error : unknown ) : void {
246
+ DEBUG_BUILD && logger . error ( '[Replay]' , error ) ;
247
+
248
+ if ( DEBUG_BUILD && this . _options . _experiments && this . _options . _experiments . captureExceptions ) {
249
+ captureException ( error ) ;
250
+ }
251
+ }
252
+
244
253
/**
245
254
* Initializes the plugin based on sampling configuration. Should not be
246
255
* called outside of constructor.
@@ -264,7 +273,7 @@ export class ReplayContainer implements ReplayContainerInterface {
264
273
265
274
if ( ! this . session ) {
266
275
// This should not happen, something wrong has occurred
267
- this . _handleException ( new Error ( 'Unable to initialize and create session' ) ) ;
276
+ this . handleException ( new Error ( 'Unable to initialize and create session' ) ) ;
268
277
return ;
269
278
}
270
279
@@ -389,7 +398,7 @@ export class ReplayContainer implements ReplayContainerInterface {
389
398
: { } ) ,
390
399
} ) ;
391
400
} catch ( err ) {
392
- this . _handleException ( err ) ;
401
+ this . handleException ( err ) ;
393
402
}
394
403
}
395
404
@@ -408,7 +417,7 @@ export class ReplayContainer implements ReplayContainerInterface {
408
417
409
418
return true ;
410
419
} catch ( err ) {
411
- this . _handleException ( err ) ;
420
+ this . handleException ( err ) ;
412
421
return false ;
413
422
}
414
423
}
@@ -450,7 +459,7 @@ export class ReplayContainer implements ReplayContainerInterface {
450
459
// is started after, it will not have `previousSessionId`
451
460
clearSession ( this ) ;
452
461
} catch ( err ) {
453
- this . _handleException ( err ) ;
462
+ this . handleException ( err ) ;
454
463
}
455
464
}
456
465
@@ -777,15 +786,6 @@ export class ReplayContainer implements ReplayContainerInterface {
777
786
this . startRecording ( ) ;
778
787
}
779
788
780
- /** A wrapper to conditionally capture exceptions. */
781
- private _handleException ( error : unknown ) : void {
782
- DEBUG_BUILD && logger . error ( '[Replay]' , error ) ;
783
-
784
- if ( DEBUG_BUILD && this . _options . _experiments && this . _options . _experiments . captureExceptions ) {
785
- captureException ( error ) ;
786
- }
787
- }
788
-
789
789
/**
790
790
* Loads (or refreshes) the current session.
791
791
*/
@@ -873,7 +873,7 @@ export class ReplayContainer implements ReplayContainerInterface {
873
873
this . _hasInitializedCoreListeners = true ;
874
874
}
875
875
} catch ( err ) {
876
- this . _handleException ( err ) ;
876
+ this . handleException ( err ) ;
877
877
}
878
878
879
879
this . _performanceCleanupCallback = setupPerformanceObserver ( this ) ;
@@ -898,7 +898,7 @@ export class ReplayContainer implements ReplayContainerInterface {
898
898
this . _performanceCleanupCallback ( ) ;
899
899
}
900
900
} catch ( err ) {
901
- this . _handleException ( err ) ;
901
+ this . handleException ( err ) ;
902
902
}
903
903
}
904
904
@@ -1161,7 +1161,7 @@ export class ReplayContainer implements ReplayContainerInterface {
1161
1161
timestamp,
1162
1162
} ) ;
1163
1163
} catch ( err ) {
1164
- this . _handleException ( err ) ;
1164
+ this . handleException ( err ) ;
1165
1165
1166
1166
// This means we retried 3 times and all of them failed,
1167
1167
// or we ran into a problem we don't want to retry, like rate limiting.
0 commit comments