@@ -214,12 +214,18 @@ export class ReplayContainer implements ReplayContainerInterface {
214
214
* Returns true if it was stopped, else false.
215
215
*/
216
216
public stopRecording ( ) : boolean {
217
- if ( this . _stopRecording ) {
218
- this . _stopRecording ( ) ;
219
- return true ;
220
- }
217
+ try {
218
+ if ( this . _stopRecording ) {
219
+ this . _stopRecording ( ) ;
220
+ this . _stopRecording = undefined ;
221
+ return true ;
222
+ }
221
223
222
- return false ;
224
+ return false ;
225
+ } catch ( err ) {
226
+ this . _handleException ( err ) ;
227
+ return false ;
228
+ }
223
229
}
224
230
225
231
/**
@@ -231,7 +237,7 @@ export class ReplayContainer implements ReplayContainerInterface {
231
237
__DEBUG_BUILD__ && logger . log ( '[Replay] Stopping Replays' ) ;
232
238
this . _isEnabled = false ;
233
239
this . _removeListeners ( ) ;
234
- this . _stopRecording && this . _stopRecording ( ) ;
240
+ this . stopRecording ( ) ;
235
241
this . eventBuffer && this . eventBuffer . destroy ( ) ;
236
242
this . eventBuffer = null ;
237
243
this . _debouncedFlush . cancel ( ) ;
@@ -247,14 +253,7 @@ export class ReplayContainer implements ReplayContainerInterface {
247
253
*/
248
254
public pause ( ) : void {
249
255
this . _isPaused = true ;
250
- try {
251
- if ( this . _stopRecording ) {
252
- this . _stopRecording ( ) ;
253
- this . _stopRecording = undefined ;
254
- }
255
- } catch ( err ) {
256
- this . _handleException ( err ) ;
257
- }
256
+ this . stopRecording ( ) ;
258
257
}
259
258
260
259
/**
@@ -658,8 +657,12 @@ export class ReplayContainer implements ReplayContainerInterface {
658
657
* create a new Replay event.
659
658
*/
660
659
private _triggerFullSnapshot ( ) : void {
661
- __DEBUG_BUILD__ && logger . log ( '[Replay] Taking full rrweb snapshot' ) ;
662
- record . takeFullSnapshot ( true ) ;
660
+ try {
661
+ __DEBUG_BUILD__ && logger . log ( '[Replay] Taking full rrweb snapshot' ) ;
662
+ record . takeFullSnapshot ( true ) ;
663
+ } catch ( err ) {
664
+ this . _handleException ( err ) ;
665
+ }
663
666
}
664
667
665
668
/**
0 commit comments