@sentry/replay 0.6.14-4 → 0.6.14-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1382,7 +1382,13 @@ var Replay = /** @class */ (function () {
1382
1382
  * Note that this will cause a new DOM checkout
1383
1383
  */
1384
1384
  Replay.prototype.startRecording = function () {
1385
- this.stopRecording = record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1385
+ try {
1386
+ this.stopRecording = record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1387
+ }
1388
+ catch (err) {
1389
+ logger.error(err);
1390
+ captureInternalException(err);
1391
+ }
1386
1392
  };
1387
1393
  /**
1388
1394
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
@@ -1393,22 +1399,35 @@ var Replay = /** @class */ (function () {
1393
1399
  if (!isBrowser) {
1394
1400
  return;
1395
1401
  }
1396
- logger.log('Stopping Replays');
1397
- this.isEnabled = false;
1398
- this.removeListeners();
1399
- (_a = this.stopRecording) === null || _a === void 0 ? void 0 : _a.call(this);
1400
- (_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
1401
- this.eventBuffer = null;
1402
+ try {
1403
+ logger.log('Stopping Replays');
1404
+ this.isEnabled = false;
1405
+ this.removeListeners();
1406
+ (_a = this.stopRecording) === null || _a === void 0 ? void 0 : _a.call(this);
1407
+ (_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
1408
+ this.eventBuffer = null;
1409
+ }
1410
+ catch (err) {
1411
+ logger.error(err);
1412
+ captureInternalException(err);
1413
+ }
1402
1414
  };
1403
1415
  /**
1404
1416
  * Pause some replay functionality. See comments for `isPaused`.
1405
1417
  * This differs from stop as this only stops DOM recording, it is
1406
- * not as thorough of a shutdown as `stop()`. */
1418
+ * not as thorough of a shutdown as `stop()`.
1419
+ */
1407
1420
  Replay.prototype.pause = function () {
1408
1421
  this.isPaused = true;
1409
- if (this.stopRecording) {
1410
- this.stopRecording();
1411
- this.stopRecording = undefined;
1422
+ try {
1423
+ if (this.stopRecording) {
1424
+ this.stopRecording();
1425
+ this.stopRecording = undefined;
1426
+ }
1427
+ }
1428
+ catch (err) {
1429
+ logger.error(err);
1430
+ captureInternalException(err);
1412
1431
  }
1413
1432
  };
1414
1433
  /**
@@ -1422,8 +1441,14 @@ var Replay = /** @class */ (function () {
1422
1441
  this.startRecording();
1423
1442
  };
1424
1443
  Replay.prototype.clearSession = function () {
1425
- deleteSession();
1426
- this.session = undefined;
1444
+ try {
1445
+ deleteSession();
1446
+ this.session = undefined;
1447
+ }
1448
+ catch (err) {
1449
+ logger.error(err);
1450
+ captureInternalException(err);
1451
+ }
1427
1452
  };
1428
1453
  /**
1429
1454
  * Loads a session from storage, or creates a new one if it does not exist or
@@ -1469,22 +1494,28 @@ var Replay = /** @class */ (function () {
1469
1494
  */
1470
1495
  Replay.prototype.addListeners = function () {
1471
1496
  var _this = this;
1472
- document.addEventListener('visibilitychange', this.handleVisibilityChange);
1473
- window.addEventListener('blur', this.handleWindowBlur);
1474
- window.addEventListener('focus', this.handleWindowFocus);
1475
- // There is no way to remove these listeners, so ensure they are only added once
1476
- if (!this.hasInitializedCoreListeners) {
1477
- // Listeners from core SDK //
1478
- var scope = getCurrentHub().getScope();
1479
- scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
1480
- addInstrumentationHandler('dom', this.handleCoreBreadcrumbListener('dom'));
1481
- addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
1482
- addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
1483
- addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
1484
- // Tag all (non replay) events that get sent to Sentry with the current
1485
- // replay ID so that we can reference them later in the UI
1486
- addGlobalEventProcessor(this.handleGlobalEvent);
1487
- this.hasInitializedCoreListeners = true;
1497
+ try {
1498
+ document.addEventListener('visibilitychange', this.handleVisibilityChange);
1499
+ window.addEventListener('blur', this.handleWindowBlur);
1500
+ window.addEventListener('focus', this.handleWindowFocus);
1501
+ // There is no way to remove these listeners, so ensure they are only added once
1502
+ if (!this.hasInitializedCoreListeners) {
1503
+ // Listeners from core SDK //
1504
+ var scope = getCurrentHub().getScope();
1505
+ scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
1506
+ addInstrumentationHandler('dom', this.handleCoreBreadcrumbListener('dom'));
1507
+ addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
1508
+ addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
1509
+ addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
1510
+ // Tag all (non replay) events that get sent to Sentry with the current
1511
+ // replay ID so that we can reference them later in the UI
1512
+ addGlobalEventProcessor(this.handleGlobalEvent);
1513
+ this.hasInitializedCoreListeners = true;
1514
+ }
1515
+ }
1516
+ catch (err) {
1517
+ logger.error(err);
1518
+ captureInternalException(err);
1488
1519
  }
1489
1520
  // PerformanceObserver //
1490
1521
  if (!('PerformanceObserver' in window)) {
@@ -1520,12 +1551,18 @@ var Replay = /** @class */ (function () {
1520
1551
  * Cleans up listeners that were created in `addListeners`
1521
1552
  */
1522
1553
  Replay.prototype.removeListeners = function () {
1523
- document.removeEventListener('visibilitychange', this.handleVisibilityChange);
1524
- window.removeEventListener('blur', this.handleWindowBlur);
1525
- window.removeEventListener('focus', this.handleWindowFocus);
1526
- if (this.performanceObserver) {
1527
- this.performanceObserver.disconnect();
1528
- this.performanceObserver = null;
1554
+ try {
1555
+ document.removeEventListener('visibilitychange', this.handleVisibilityChange);
1556
+ window.removeEventListener('blur', this.handleWindowBlur);
1557
+ window.removeEventListener('focus', this.handleWindowFocus);
1558
+ if (this.performanceObserver) {
1559
+ this.performanceObserver.disconnect();
1560
+ this.performanceObserver = null;
1561
+ }
1562
+ }
1563
+ catch (err) {
1564
+ logger.error(err);
1565
+ captureInternalException(err);
1529
1566
  }
1530
1567
  };
1531
1568
  /**
@@ -1898,7 +1935,7 @@ var Replay = /** @class */ (function () {
1898
1935
  currentTimestamp = new Date().getTime();
1899
1936
  sdkInfo = {
1900
1937
  name: 'sentry.javascript.integration.replay',
1901
- version: "0.6.14-4",
1938
+ version: "0.6.14-5",
1902
1939
  };
1903
1940
  return [4 /*yield*/, new Promise(function (resolve) {
1904
1941
  var _a;
package/dist/index.js CHANGED
@@ -1390,7 +1390,13 @@ var Replay = /** @class */ (function () {
1390
1390
  * Note that this will cause a new DOM checkout
1391
1391
  */
1392
1392
  Replay.prototype.startRecording = function () {
1393
- this.stopRecording = rrweb.record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1393
+ try {
1394
+ this.stopRecording = rrweb.record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1395
+ }
1396
+ catch (err) {
1397
+ logger.error(err);
1398
+ captureInternalException(err);
1399
+ }
1394
1400
  };
1395
1401
  /**
1396
1402
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK
@@ -1401,22 +1407,35 @@ var Replay = /** @class */ (function () {
1401
1407
  if (!isBrowser) {
1402
1408
  return;
1403
1409
  }
1404
- logger.log('Stopping Replays');
1405
- this.isEnabled = false;
1406
- this.removeListeners();
1407
- (_a = this.stopRecording) === null || _a === void 0 ? void 0 : _a.call(this);
1408
- (_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
1409
- this.eventBuffer = null;
1410
+ try {
1411
+ logger.log('Stopping Replays');
1412
+ this.isEnabled = false;
1413
+ this.removeListeners();
1414
+ (_a = this.stopRecording) === null || _a === void 0 ? void 0 : _a.call(this);
1415
+ (_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
1416
+ this.eventBuffer = null;
1417
+ }
1418
+ catch (err) {
1419
+ logger.error(err);
1420
+ captureInternalException(err);
1421
+ }
1410
1422
  };
1411
1423
  /**
1412
1424
  * Pause some replay functionality. See comments for `isPaused`.
1413
1425
  * This differs from stop as this only stops DOM recording, it is
1414
- * not as thorough of a shutdown as `stop()`. */
1426
+ * not as thorough of a shutdown as `stop()`.
1427
+ */
1415
1428
  Replay.prototype.pause = function () {
1416
1429
  this.isPaused = true;
1417
- if (this.stopRecording) {
1418
- this.stopRecording();
1419
- this.stopRecording = undefined;
1430
+ try {
1431
+ if (this.stopRecording) {
1432
+ this.stopRecording();
1433
+ this.stopRecording = undefined;
1434
+ }
1435
+ }
1436
+ catch (err) {
1437
+ logger.error(err);
1438
+ captureInternalException(err);
1420
1439
  }
1421
1440
  };
1422
1441
  /**
@@ -1430,8 +1449,14 @@ var Replay = /** @class */ (function () {
1430
1449
  this.startRecording();
1431
1450
  };
1432
1451
  Replay.prototype.clearSession = function () {
1433
- deleteSession();
1434
- this.session = undefined;
1452
+ try {
1453
+ deleteSession();
1454
+ this.session = undefined;
1455
+ }
1456
+ catch (err) {
1457
+ logger.error(err);
1458
+ captureInternalException(err);
1459
+ }
1435
1460
  };
1436
1461
  /**
1437
1462
  * Loads a session from storage, or creates a new one if it does not exist or
@@ -1477,22 +1502,28 @@ var Replay = /** @class */ (function () {
1477
1502
  */
1478
1503
  Replay.prototype.addListeners = function () {
1479
1504
  var _this = this;
1480
- document.addEventListener('visibilitychange', this.handleVisibilityChange);
1481
- window.addEventListener('blur', this.handleWindowBlur);
1482
- window.addEventListener('focus', this.handleWindowFocus);
1483
- // There is no way to remove these listeners, so ensure they are only added once
1484
- if (!this.hasInitializedCoreListeners) {
1485
- // Listeners from core SDK //
1486
- var scope = core.getCurrentHub().getScope();
1487
- scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
1488
- utils.addInstrumentationHandler('dom', this.handleCoreBreadcrumbListener('dom'));
1489
- utils.addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
1490
- utils.addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
1491
- utils.addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
1492
- // Tag all (non replay) events that get sent to Sentry with the current
1493
- // replay ID so that we can reference them later in the UI
1494
- core.addGlobalEventProcessor(this.handleGlobalEvent);
1495
- this.hasInitializedCoreListeners = true;
1505
+ try {
1506
+ document.addEventListener('visibilitychange', this.handleVisibilityChange);
1507
+ window.addEventListener('blur', this.handleWindowBlur);
1508
+ window.addEventListener('focus', this.handleWindowFocus);
1509
+ // There is no way to remove these listeners, so ensure they are only added once
1510
+ if (!this.hasInitializedCoreListeners) {
1511
+ // Listeners from core SDK //
1512
+ var scope = core.getCurrentHub().getScope();
1513
+ scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
1514
+ utils.addInstrumentationHandler('dom', this.handleCoreBreadcrumbListener('dom'));
1515
+ utils.addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
1516
+ utils.addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
1517
+ utils.addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
1518
+ // Tag all (non replay) events that get sent to Sentry with the current
1519
+ // replay ID so that we can reference them later in the UI
1520
+ core.addGlobalEventProcessor(this.handleGlobalEvent);
1521
+ this.hasInitializedCoreListeners = true;
1522
+ }
1523
+ }
1524
+ catch (err) {
1525
+ logger.error(err);
1526
+ captureInternalException(err);
1496
1527
  }
1497
1528
  // PerformanceObserver //
1498
1529
  if (!('PerformanceObserver' in window)) {
@@ -1528,12 +1559,18 @@ var Replay = /** @class */ (function () {
1528
1559
  * Cleans up listeners that were created in `addListeners`
1529
1560
  */
1530
1561
  Replay.prototype.removeListeners = function () {
1531
- document.removeEventListener('visibilitychange', this.handleVisibilityChange);
1532
- window.removeEventListener('blur', this.handleWindowBlur);
1533
- window.removeEventListener('focus', this.handleWindowFocus);
1534
- if (this.performanceObserver) {
1535
- this.performanceObserver.disconnect();
1536
- this.performanceObserver = null;
1562
+ try {
1563
+ document.removeEventListener('visibilitychange', this.handleVisibilityChange);
1564
+ window.removeEventListener('blur', this.handleWindowBlur);
1565
+ window.removeEventListener('focus', this.handleWindowFocus);
1566
+ if (this.performanceObserver) {
1567
+ this.performanceObserver.disconnect();
1568
+ this.performanceObserver = null;
1569
+ }
1570
+ }
1571
+ catch (err) {
1572
+ logger.error(err);
1573
+ captureInternalException(err);
1537
1574
  }
1538
1575
  };
1539
1576
  /**
@@ -1906,7 +1943,7 @@ var Replay = /** @class */ (function () {
1906
1943
  currentTimestamp = new Date().getTime();
1907
1944
  sdkInfo = {
1908
1945
  name: 'sentry.javascript.integration.replay',
1909
- version: "0.6.14-4",
1946
+ version: "0.6.14-5",
1910
1947
  };
1911
1948
  return [4 /*yield*/, new Promise(function (resolve) {
1912
1949
  var _a;