@@ -241,6 +241,15 @@ export class ReplayContainer implements ReplayContainerInterface {
241241 return this . _options ;
242242 }
243243
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+
244253 /**
245254 * Initializes the plugin based on sampling configuration. Should not be
246255 * called outside of constructor.
@@ -264,7 +273,7 @@ export class ReplayContainer implements ReplayContainerInterface {
264273
265274 if ( ! this . session ) {
266275 // 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' ) ) ;
268277 return ;
269278 }
270279
@@ -389,7 +398,7 @@ export class ReplayContainer implements ReplayContainerInterface {
389398 : { } ) ,
390399 } ) ;
391400 } catch ( err ) {
392- this . _handleException ( err ) ;
401+ this . handleException ( err ) ;
393402 }
394403 }
395404
@@ -408,7 +417,7 @@ export class ReplayContainer implements ReplayContainerInterface {
408417
409418 return true ;
410419 } catch ( err ) {
411- this . _handleException ( err ) ;
420+ this . handleException ( err ) ;
412421 return false ;
413422 }
414423 }
@@ -450,7 +459,7 @@ export class ReplayContainer implements ReplayContainerInterface {
450459 // is started after, it will not have `previousSessionId`
451460 clearSession ( this ) ;
452461 } catch ( err ) {
453- this . _handleException ( err ) ;
462+ this . handleException ( err ) ;
454463 }
455464 }
456465
@@ -777,15 +786,6 @@ export class ReplayContainer implements ReplayContainerInterface {
777786 this . startRecording ( ) ;
778787 }
779788
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-
789789 /**
790790 * Loads (or refreshes) the current session.
791791 */
@@ -873,7 +873,7 @@ export class ReplayContainer implements ReplayContainerInterface {
873873 this . _hasInitializedCoreListeners = true ;
874874 }
875875 } catch ( err ) {
876- this . _handleException ( err ) ;
876+ this . handleException ( err ) ;
877877 }
878878
879879 this . _performanceCleanupCallback = setupPerformanceObserver ( this ) ;
@@ -898,7 +898,7 @@ export class ReplayContainer implements ReplayContainerInterface {
898898 this . _performanceCleanupCallback ( ) ;
899899 }
900900 } catch ( err ) {
901- this . _handleException ( err ) ;
901+ this . handleException ( err ) ;
902902 }
903903 }
904904
@@ -1161,7 +1161,7 @@ export class ReplayContainer implements ReplayContainerInterface {
11611161 timestamp,
11621162 } ) ;
11631163 } catch ( err ) {
1164- this . _handleException ( err ) ;
1164+ this . handleException ( err ) ;
11651165
11661166 // This means we retried 3 times and all of them failed,
11671167 // or we ran into a problem we don't want to retry, like rate limiting.
0 commit comments