@sentry/replay 0.5.11 → 0.5.14

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/README.md CHANGED
@@ -46,6 +46,18 @@ Sentry.init({
46
46
  });
47
47
  ```
48
48
 
49
+ ### Stopping Replays
50
+
51
+ To stop replays you can call the `destroy()` method on the integration instance. It's possible to resume recording by calling `setup()`.
52
+
53
+ ```javascript
54
+
55
+ const replay = new SentryReplay(); // This will begin recording replays
56
+
57
+ replay.destroy(); // Stop recording
58
+
59
+ replay.setup(); // Start recording again
60
+ ```
49
61
 
50
62
  ## Configuration
51
63
 
@@ -1,6 +1,5 @@
1
1
  import { Breadcrumb, Event, Integration } from '@sentry/types';
2
- import { CaptureReplayParams } from './api/captureReplay';
3
- import { CaptureReplayUpdateParams } from './api/captureReplayUpdate';
2
+ import { CaptureReplayEventParams } from './api/captureReplayEvent';
4
3
  import { Session } from './session/Session';
5
4
  import { ReplayPerformanceEntry } from './createPerformanceEntry';
6
5
  import { IEventBuffer } from './eventBuffer';
@@ -18,11 +17,7 @@ export declare class SentryReplay implements Integration {
18
17
  * @inheritDoc
19
18
  */
20
19
  name: string;
21
- eventBuffer: IEventBuffer;
22
- /**
23
- * Buffer of breadcrumbs to be uploaded
24
- */
25
- breadcrumbs: Breadcrumb[];
20
+ eventBuffer: IEventBuffer | null;
26
21
  /**
27
22
  * List of PerformanceEntry from PerformanceObserver
28
23
  */
@@ -46,12 +41,23 @@ export declare class SentryReplay implements Integration {
46
41
  private retryCount;
47
42
  private retryInterval;
48
43
  /**
49
- * Flag to make sure we only create a replay event when
50
- * necessary (i.e. we only want to have a single replay
51
- * event per session and it should only be created
52
- * immediately before sending recording)
44
+ * Flag when a new session has been created. Captured replay events behave
45
+ * slightly differently in this case: `replay_start_timestamp` is included.
46
+ */
47
+ private newSessionCreated;
48
+ /**
49
+ * Is the integration currently active?
50
+ */
51
+ private isEnabled;
52
+ /**
53
+ * Have we attached listeners to the core SDK?
54
+ * Note we have to track this as there is no way to remove instrumentation handlers.
55
+ */
56
+ private hasInitializedCoreListeners;
57
+ /**
58
+ * Function to stop recording
53
59
  */
54
- private needsCaptureReplay;
60
+ private stopRecording;
55
61
  /**
56
62
  * Captured state when integration is first initialized
57
63
  */
@@ -208,7 +214,7 @@ export declare class SentryReplay implements Integration {
208
214
  */
209
215
  popEventContext({ timestamp, }?: {
210
216
  timestamp?: number;
211
- }): CaptureReplayParams & CaptureReplayUpdateParams;
217
+ }): CaptureReplayEventParams;
212
218
  /**
213
219
  * Flushes replay event buffer to Sentry.
214
220
  *
@@ -219,11 +225,11 @@ export declare class SentryReplay implements Integration {
219
225
  /**
220
226
  * Send replay attachment using `fetch()`
221
227
  */
222
- sendReplayRequest({ endpoint, events }: ReplayRequest): Promise<void>;
228
+ sendReplayRequest({ endpoint, events, replayId: event_id, segmentId: segment_id, }: ReplayRequest): Promise<void>;
223
229
  resetRetries(): void;
224
230
  /**
225
231
  * Finalize and send the current replay event to Sentry
226
232
  */
227
- sendReplay(eventId: string, events: RecordedEvents): Promise<boolean | undefined>;
233
+ sendReplay(replayId: string, events: RecordedEvents, segmentId: number): Promise<true | undefined>;
228
234
  }
229
235
  export {};
@@ -6,6 +6,8 @@ export declare type RecordedEvents = Uint8Array | string;
6
6
  export interface ReplayRequest {
7
7
  endpoint: string;
8
8
  events: RecordedEvents;
9
+ replayId: string;
10
+ segmentId: number;
9
11
  }
10
12
  export declare type InstrumentationTypeBreadcrumb = 'dom' | 'scope';
11
13
  export declare type InstrumentationTypeSpan = 'fetch' | 'xhr' | 'history';
package/dist/index.es.js CHANGED
@@ -95,32 +95,13 @@ var SESSION_IDLE_DURATION = 900000; // 15 minutes
95
95
  // Grace period to keep a session when a user changes tabs or hides window
96
96
  var VISIBILITY_CHANGE_TIMEOUT = SESSION_IDLE_DURATION;
97
97
 
98
- function captureReplay(_a) {
99
- var session = _a.session, initialState = _a.initialState, errorIds = _a.errorIds, traceIds = _a.traceIds, urls = _a.urls;
100
- captureEvent({
98
+ function captureReplayEvent(_a) {
99
+ var initialState = _a.initialState, includeReplayStartTimestamp = _a.includeReplayStartTimestamp, errorIds = _a.errorIds, replay_id = _a.replayId, segment_id = _a.segmentId, timestamp = _a.timestamp, traceIds = _a.traceIds, urls = _a.urls;
100
+ captureEvent(__assign(__assign(__assign({
101
101
  // @ts-expect-error replay_event is a new event type
102
- type: REPLAY_EVENT_NAME,
103
- replay_start_timestamp: initialState.timestamp / 1000,
104
- error_ids: errorIds,
105
- trace_ids: traceIds,
106
- urls: urls,
107
- replay_id: session.id,
108
- segment_id: session.segmentId, // TODO: Should this increment?
109
- }, { event_id: session.id });
110
- }
111
-
112
- function captureReplayUpdate(_a) {
113
- var session = _a.session, timestamp = _a.timestamp, errorIds = _a.errorIds, traceIds = _a.traceIds, urls = _a.urls;
114
- captureEvent({
115
- // @ts-expect-error replay_event is a new event type
116
- type: REPLAY_EVENT_NAME,
117
- timestamp: timestamp / 1000,
118
- error_ids: errorIds,
119
- trace_ids: traceIds,
120
- urls: urls,
121
- replay_id: session.id,
122
- segment_id: ++session.segmentId,
123
- });
102
+ type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
103
+ ? { replay_start_timestamp: initialState.timestamp / 1000 }
104
+ : {})), (timestamp ? { timestamp: timestamp / 1000 } : {})), { error_ids: errorIds, trace_ids: traceIds, urls: urls, replay_id: replay_id, segment_id: segment_id }), { event_id: replay_id });
124
105
  }
125
106
 
126
107
  function createBreadcrumb(breadcrumb) {
@@ -798,7 +779,7 @@ var EventBufferCompressionWorker = /** @class */ (function () {
798
779
  }());
799
780
 
800
781
  var BASE_RETRY_INTERVAL = 5000;
801
- var MAX_RETRY_COUNT = 5;
782
+ var MAX_RETRY_COUNT = 3;
802
783
  var UNABLE_TO_SEND_REPLAY = 'Unable to send replay';
803
784
  var SentryReplay = /** @class */ (function () {
804
785
  function SentryReplay(_a) {
@@ -809,10 +790,6 @@ var SentryReplay = /** @class */ (function () {
809
790
  * @inheritDoc
810
791
  */
811
792
  this.name = SentryReplay.id;
812
- /**
813
- * Buffer of breadcrumbs to be uploaded
814
- */
815
- this.breadcrumbs = [];
816
793
  /**
817
794
  * List of PerformanceEntry from PerformanceObserver
818
795
  */
@@ -827,12 +804,23 @@ var SentryReplay = /** @class */ (function () {
827
804
  this.retryCount = 0;
828
805
  this.retryInterval = BASE_RETRY_INTERVAL;
829
806
  /**
830
- * Flag to make sure we only create a replay event when
831
- * necessary (i.e. we only want to have a single replay
832
- * event per session and it should only be created
833
- * immediately before sending recording)
807
+ * Flag when a new session has been created. Captured replay events behave
808
+ * slightly differently in this case: `replay_start_timestamp` is included.
809
+ */
810
+ this.newSessionCreated = false;
811
+ /**
812
+ * Is the integration currently active?
834
813
  */
835
- this.needsCaptureReplay = false;
814
+ this.isEnabled = false;
815
+ /**
816
+ * Have we attached listeners to the core SDK?
817
+ * Note we have to track this as there is no way to remove instrumentation handlers.
818
+ */
819
+ this.hasInitializedCoreListeners = false;
820
+ /**
821
+ * Function to stop recording
822
+ */
823
+ this.stopRecording = null;
836
824
  this.context = {
837
825
  errorIds: new Set(),
838
826
  traceIds: new Set(),
@@ -951,6 +939,9 @@ var SentryReplay = /** @class */ (function () {
951
939
  *
952
940
  */
953
941
  this.handleCoreSpanListener = function (type) { return function (handlerData) {
942
+ if (!_this.isEnabled) {
943
+ return;
944
+ }
954
945
  var handler = getSpanHandler(type);
955
946
  var result = handler(handlerData);
956
947
  if (result === null) {
@@ -974,6 +965,9 @@ var SentryReplay = /** @class */ (function () {
974
965
  * These events will create breadcrumb-like objects in the recording.
975
966
  */
976
967
  this.handleCoreBreadcrumbListener = function (type) { return function (handlerData) {
968
+ if (!_this.isEnabled) {
969
+ return;
970
+ }
977
971
  var handler = getBreadcrumbHandler(type);
978
972
  var result = handler(handlerData);
979
973
  if (result === null) {
@@ -1056,7 +1050,8 @@ var SentryReplay = /** @class */ (function () {
1056
1050
  // Tag all (non replay) events that get sent to Sentry with the current
1057
1051
  // replay ID so that we can reference them later in the UI
1058
1052
  addGlobalEventProcessor(this.handleGlobalEvent);
1059
- record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1053
+ this.stopRecording = record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1054
+ this.isEnabled = true;
1060
1055
  };
1061
1056
  /**
1062
1057
  * We want to batch uploads of replay events. Save events only if
@@ -1111,8 +1106,13 @@ var SentryReplay = /** @class */ (function () {
1111
1106
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
1112
1107
  */
1113
1108
  SentryReplay.prototype.destroy = function () {
1109
+ var _a, _b;
1114
1110
  logger.log('Destroying instance');
1111
+ this.isEnabled = false;
1115
1112
  this.removeListeners();
1113
+ (_a = this.stopRecording) === null || _a === void 0 ? void 0 : _a.call(this);
1114
+ (_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
1115
+ this.eventBuffer = null;
1116
1116
  };
1117
1117
  SentryReplay.prototype.clearSession = function () {
1118
1118
  deleteSession();
@@ -1134,7 +1134,7 @@ var SentryReplay = /** @class */ (function () {
1134
1134
  // If session was newly created (i.e. was not loaded from storage), then
1135
1135
  // enable flag to create the root replay
1136
1136
  if (type === 'new') {
1137
- this.needsCaptureReplay = true;
1137
+ this.newSessionCreated = true;
1138
1138
  this.setInitialState();
1139
1139
  }
1140
1140
  if (session.id !== ((_b = this.session) === null || _b === void 0 ? void 0 : _b.id)) {
@@ -1150,6 +1150,7 @@ var SentryReplay = /** @class */ (function () {
1150
1150
  SentryReplay.prototype.setInitialState = function () {
1151
1151
  var urlPath = "".concat(window.location.pathname).concat(window.location.hash).concat(window.location.search);
1152
1152
  var url = "".concat(window.location.origin).concat(urlPath);
1153
+ this.performanceEvents = [];
1153
1154
  // Reset context as well
1154
1155
  this.popEventContext();
1155
1156
  this.initialState = {
@@ -1166,13 +1167,17 @@ var SentryReplay = /** @class */ (function () {
1166
1167
  document.addEventListener('visibilitychange', this.handleVisibilityChange);
1167
1168
  window.addEventListener('blur', this.handleWindowBlur);
1168
1169
  window.addEventListener('focus', this.handleWindowFocus);
1169
- // Listeners from core SDK //
1170
- var scope = getCurrentHub().getScope();
1171
- scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
1172
- addInstrumentationHandler('dom', this.handleCoreBreadcrumbListener('dom'));
1173
- addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
1174
- addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
1175
- addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
1170
+ // There is no way to remove these listeners, so ensure they are only added once
1171
+ if (!this.hasInitializedCoreListeners) {
1172
+ // Listeners from core SDK //
1173
+ var scope = getCurrentHub().getScope();
1174
+ scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
1175
+ addInstrumentationHandler('dom', this.handleCoreBreadcrumbListener('dom'));
1176
+ addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
1177
+ addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
1178
+ addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
1179
+ this.hasInitializedCoreListeners = true;
1180
+ }
1176
1181
  // PerformanceObserver //
1177
1182
  if (!('PerformanceObserver' in window)) {
1178
1183
  return;
@@ -1269,7 +1274,14 @@ var SentryReplay = /** @class */ (function () {
1269
1274
  * Add an event to the event buffer
1270
1275
  */
1271
1276
  SentryReplay.prototype.addEvent = function (event, isCheckout) {
1272
- var timestampInMs = event.timestamp * 1000;
1277
+ if (!this.eventBuffer) {
1278
+ // This implies that `isEnabled` is false
1279
+ return;
1280
+ }
1281
+ // TODO: sadness -- we will want to normalize timestamps to be in ms -
1282
+ // requires coordination with frontend
1283
+ var isMs = event.timestamp > 9999999999;
1284
+ var timestampInMs = isMs ? event.timestamp : event.timestamp * 1000;
1273
1285
  if (!this.context.earliestEvent ||
1274
1286
  timestampInMs < this.context.earliestEvent) {
1275
1287
  this.context.earliestEvent = timestampInMs;
@@ -1394,7 +1406,6 @@ var SentryReplay = /** @class */ (function () {
1394
1406
  initialState.timestamp = this.context.earliestEvent;
1395
1407
  }
1396
1408
  var context = {
1397
- session: this.session,
1398
1409
  initialState: initialState,
1399
1410
  timestamp: timestamp,
1400
1411
  errorIds: Array.from(this.context.errorIds).filter(Boolean),
@@ -1415,12 +1426,17 @@ var SentryReplay = /** @class */ (function () {
1415
1426
  * due to the buffered performance observer events.
1416
1427
  */
1417
1428
  SentryReplay.prototype.flushUpdate = function () {
1418
- var _a;
1429
+ var _a, _b;
1419
1430
  return __awaiter(this, void 0, void 0, function () {
1420
- var timestamp, recordingData, err_1;
1421
- return __generator(this, function (_b) {
1422
- switch (_b.label) {
1431
+ var timestamp, replayId, newSessionCreated, segmentId, recordingData, err_1;
1432
+ return __generator(this, function (_c) {
1433
+ switch (_c.label) {
1423
1434
  case 0:
1435
+ if (!this.isEnabled) {
1436
+ // This is just a precaution, there should be no listeners that would
1437
+ // cause a flush.
1438
+ return [2 /*return*/];
1439
+ }
1424
1440
  if (!this.checkAndHandleExpiredSession()) {
1425
1441
  logger.error(new Error('Attempting to finish replay event after session expired.'));
1426
1442
  return [2 /*return*/];
@@ -1433,44 +1449,42 @@ var SentryReplay = /** @class */ (function () {
1433
1449
  clearTimeout(this.timeout);
1434
1450
  return [4 /*yield*/, this.addPerformanceEntries()];
1435
1451
  case 1:
1436
- _b.sent();
1437
- if (!this.eventBuffer.length) {
1452
+ _c.sent();
1453
+ if (!((_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.length)) {
1438
1454
  return [2 /*return*/];
1439
1455
  }
1440
1456
  // Only attach memory event if eventBuffer is not empty
1441
1457
  return [4 /*yield*/, this.addMemoryEntry()];
1442
1458
  case 2:
1443
1459
  // Only attach memory event if eventBuffer is not empty
1444
- _b.sent();
1460
+ _c.sent();
1445
1461
  timestamp = new Date().getTime();
1446
- // Only want to create replay event if session is new
1447
- if (this.needsCaptureReplay) {
1448
- // This event needs to exist before calling `sendReplay`
1449
- captureReplay(this.popEventContext({ timestamp: timestamp }));
1450
- this.needsCaptureReplay = false;
1451
- }
1462
+ replayId = this.session.id;
1463
+ newSessionCreated = this.newSessionCreated;
1464
+ segmentId = this.session.segmentId++;
1452
1465
  // Reset this to null regardless of `sendReplay` result so that future
1453
1466
  // events will get flushed properly
1454
1467
  this.initialEventTimestampSinceFlush = null;
1455
- _b.label = 3;
1468
+ _c.label = 3;
1456
1469
  case 3:
1457
- _b.trys.push([3, 6, , 7]);
1470
+ _c.trys.push([3, 6, , 7]);
1458
1471
  return [4 /*yield*/, this.eventBuffer.finish()];
1459
1472
  case 4:
1460
- recordingData = _b.sent();
1461
- return [4 /*yield*/, this.sendReplay(this.session.id, recordingData)];
1473
+ recordingData = _c.sent();
1474
+ return [4 /*yield*/, this.sendReplay(replayId, recordingData, segmentId)];
1462
1475
  case 5:
1463
- _b.sent();
1476
+ _c.sent();
1464
1477
  // The below will only happen after successfully sending replay //
1465
1478
  // TBD: Alternatively we could update this after every rrweb event
1466
1479
  // `timestamp` should reflect when the event happens. e.g. the timestamp
1467
1480
  // of the event is passed as an argument in the case where a timeout
1468
1481
  // occurs.
1469
1482
  this.updateLastActivity(timestamp);
1470
- captureReplayUpdate(this.popEventContext({ timestamp: timestamp }));
1483
+ captureReplayEvent(__assign(__assign({}, this.popEventContext({ timestamp: timestamp })), { replayId: replayId, segmentId: segmentId, includeReplayStartTimestamp: newSessionCreated }));
1484
+ this.newSessionCreated = false;
1471
1485
  return [3 /*break*/, 7];
1472
1486
  case 6:
1473
- err_1 = _b.sent();
1487
+ err_1 = _c.sent();
1474
1488
  captureException(err_1);
1475
1489
  console.error(err_1);
1476
1490
  return [3 /*break*/, 7];
@@ -1483,22 +1497,21 @@ var SentryReplay = /** @class */ (function () {
1483
1497
  * Send replay attachment using `fetch()`
1484
1498
  */
1485
1499
  SentryReplay.prototype.sendReplayRequest = function (_a) {
1486
- var _b, _c;
1487
- var endpoint = _a.endpoint, events = _a.events;
1500
+ var endpoint = _a.endpoint, events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId;
1488
1501
  return __awaiter(this, void 0, void 0, function () {
1489
- var payloadWithSequence, envelope, response, _d, _e;
1490
- var _f;
1491
- return __generator(this, function (_g) {
1492
- switch (_g.label) {
1502
+ var payloadWithSequence, envelope, response, _b, _c;
1503
+ var _d;
1504
+ return __generator(this, function (_e) {
1505
+ switch (_e.label) {
1493
1506
  case 0:
1494
1507
  payloadWithSequence = createPayload({
1495
1508
  events: events,
1496
1509
  headers: {
1497
- segment_id: (_b = this.session) === null || _b === void 0 ? void 0 : _b.segmentId,
1510
+ segment_id: segment_id,
1498
1511
  },
1499
1512
  });
1500
1513
  envelope = createEnvelope({
1501
- event_id: (_c = this.session) === null || _c === void 0 ? void 0 : _c.id,
1514
+ event_id: event_id,
1502
1515
  sent_at: new Date().toISOString(),
1503
1516
  sdk: { name: 'sentry.javascript.integration.replay', version: '1.0.0' },
1504
1517
  }, [
@@ -1519,17 +1532,17 @@ var SentryReplay = /** @class */ (function () {
1519
1532
  body: serializeEnvelope(envelope),
1520
1533
  })];
1521
1534
  case 1:
1522
- response = _g.sent();
1535
+ response = _e.sent();
1523
1536
  if (!(response.status !== 200)) return [3 /*break*/, 3];
1524
- _d = setContext;
1525
- _e = ['Send Replay Response'];
1526
- _f = {
1537
+ _b = setContext;
1538
+ _c = ['Send Replay Response'];
1539
+ _d = {
1527
1540
  status: response.status
1528
1541
  };
1529
1542
  return [4 /*yield*/, response.text()];
1530
1543
  case 2:
1531
- _d.apply(void 0, _e.concat([(_f.body = _g.sent(),
1532
- _f)]));
1544
+ _b.apply(void 0, _c.concat([(_d.body = _e.sent(),
1545
+ _d)]));
1533
1546
  throw new Error(UNABLE_TO_SEND_REPLAY);
1534
1547
  case 3: return [2 /*return*/];
1535
1548
  }
@@ -1543,7 +1556,7 @@ var SentryReplay = /** @class */ (function () {
1543
1556
  /**
1544
1557
  * Finalize and send the current replay event to Sentry
1545
1558
  */
1546
- SentryReplay.prototype.sendReplay = function (eventId, events) {
1559
+ SentryReplay.prototype.sendReplay = function (replayId, events, segmentId) {
1547
1560
  return __awaiter(this, void 0, void 0, function () {
1548
1561
  var client, endpoint, ex_1;
1549
1562
  var _this = this;
@@ -1562,6 +1575,8 @@ var SentryReplay = /** @class */ (function () {
1562
1575
  return [4 /*yield*/, this.sendReplayRequest({
1563
1576
  endpoint: endpoint,
1564
1577
  events: events,
1578
+ replayId: replayId,
1579
+ segmentId: segmentId,
1565
1580
  })];
1566
1581
  case 2:
1567
1582
  _b.sent();
@@ -1580,29 +1595,30 @@ var SentryReplay = /** @class */ (function () {
1580
1595
  // failed, we'll can retry with the same events payload
1581
1596
  if (this.retryCount >= MAX_RETRY_COUNT) {
1582
1597
  this.resetRetries();
1583
- return [2 /*return*/, false];
1598
+ throw new Error(UNABLE_TO_SEND_REPLAY);
1584
1599
  }
1585
1600
  this.retryCount = this.retryCount + 1;
1586
- // will retry in intervals of 5, 10, 15, 20, 25 seconds
1601
+ // will retry in intervals of 5, 10, 30
1587
1602
  this.retryInterval = this.retryCount * this.retryInterval;
1588
1603
  _b.label = 4;
1589
1604
  case 4:
1590
1605
  _b.trys.push([4, 6, , 7]);
1591
1606
  return [4 /*yield*/, new Promise(function (resolve, reject) {
1592
1607
  setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
1593
- var result;
1594
- return __generator(this, function (_a) {
1595
- switch (_a.label) {
1596
- case 0: return [4 /*yield*/, this.sendReplay(eventId, events)];
1608
+ return __generator(this, function (_b) {
1609
+ switch (_b.label) {
1610
+ case 0:
1611
+ _b.trys.push([0, 2, , 3]);
1612
+ return [4 /*yield*/, this.sendReplay(replayId, events, segmentId)];
1597
1613
  case 1:
1598
- result = _a.sent();
1599
- if (result) {
1600
- resolve(true);
1601
- }
1602
- else {
1603
- reject(new Error('Could not send replay'));
1604
- }
1605
- return [2 /*return*/];
1614
+ _b.sent();
1615
+ resolve(true);
1616
+ return [3 /*break*/, 3];
1617
+ case 2:
1618
+ _b.sent();
1619
+ reject(new Error(UNABLE_TO_SEND_REPLAY));
1620
+ return [3 /*break*/, 3];
1621
+ case 3: return [2 /*return*/];
1606
1622
  }
1607
1623
  });
1608
1624
  }); }, _this.retryInterval);
@@ -1612,7 +1628,7 @@ var SentryReplay = /** @class */ (function () {
1612
1628
  return [2 /*return*/, true];
1613
1629
  case 6:
1614
1630
  _b.sent();
1615
- return [2 /*return*/, false];
1631
+ throw new Error(UNABLE_TO_SEND_REPLAY);
1616
1632
  case 7: return [3 /*break*/, 8];
1617
1633
  case 8: return [2 /*return*/];
1618
1634
  }