@sentry/browser 6.18.0 → 6.18.2
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/build/bundle.es6.js +158 -123
- package/build/bundle.es6.js.map +1 -1
- package/build/bundle.es6.min.js +2 -2
- package/build/bundle.es6.min.js.map +1 -1
- package/build/bundle.js +168 -130
- package/build/bundle.js.map +1 -1
- package/build/bundle.min.js +2 -2
- package/build/bundle.min.js.map +1 -1
- package/dist/backend.js +2 -2
- package/dist/backend.js.map +1 -1
- package/dist/eventbuilder.d.ts +24 -10
- package/dist/eventbuilder.d.ts.map +1 -1
- package/dist/eventbuilder.js +119 -23
- package/dist/eventbuilder.js.map +1 -1
- package/dist/helpers.js +2 -2
- package/dist/helpers.js.map +1 -1
- package/dist/integrations/dedupe.js +1 -1
- package/dist/integrations/dedupe.js.map +1 -1
- package/dist/integrations/globalhandlers.js +2 -8
- package/dist/integrations/globalhandlers.js.map +1 -1
- package/dist/integrations/linkederrors.js +2 -2
- package/dist/integrations/linkederrors.js.map +1 -1
- package/dist/stack-parsers.d.ts +5 -5
- package/dist/stack-parsers.d.ts.map +1 -1
- package/dist/stack-parsers.js +16 -6
- package/dist/stack-parsers.js.map +1 -1
- package/dist/transports/base.d.ts.map +1 -1
- package/dist/transports/base.js +11 -18
- package/dist/transports/base.js.map +1 -1
- package/dist/transports/utils.js +1 -1
- package/dist/transports/utils.js.map +1 -1
- package/esm/backend.js +2 -2
- package/esm/backend.js.map +1 -1
- package/esm/eventbuilder.d.ts +24 -10
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +113 -21
- package/esm/eventbuilder.js.map +1 -1
- package/esm/helpers.js +2 -2
- package/esm/helpers.js.map +1 -1
- package/esm/integrations/dedupe.js +1 -1
- package/esm/integrations/dedupe.js.map +1 -1
- package/esm/integrations/globalhandlers.js +2 -8
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/linkederrors.js +1 -1
- package/esm/integrations/linkederrors.js.map +1 -1
- package/esm/stack-parsers.d.ts +5 -5
- package/esm/stack-parsers.d.ts.map +1 -1
- package/esm/stack-parsers.js +16 -6
- package/esm/stack-parsers.js.map +1 -1
- package/esm/transports/base.d.ts.map +1 -1
- package/esm/transports/base.js +13 -20
- package/esm/transports/base.js.map +1 -1
- package/esm/transports/utils.js +1 -1
- package/esm/transports/utils.js.map +1 -1
- package/package.json +5 -5
- package/dist/parsers.d.ts +0 -21
- package/dist/parsers.d.ts.map +0 -1
- package/dist/parsers.js +0 -108
- package/dist/parsers.js.map +0 -1
- package/esm/parsers.d.ts +0 -21
- package/esm/parsers.d.ts.map +0 -1
- package/esm/parsers.js +0 -103
- package/esm/parsers.js.map +0 -1
package/build/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @sentry/browser 6.18.
|
|
1
|
+
/*! @sentry/browser 6.18.2 (22f518e) | https://github.com/getsentry/sentry-javascript */
|
|
2
2
|
var Sentry = (function (exports) {
|
|
3
3
|
|
|
4
4
|
/*! *****************************************************************************
|
|
@@ -588,7 +588,8 @@ var Sentry = (function (exports) {
|
|
|
588
588
|
return;
|
|
589
589
|
}
|
|
590
590
|
consoleSandbox(function () {
|
|
591
|
-
|
|
591
|
+
var _a;
|
|
592
|
+
(_a = global$6.console).log.apply(_a, __spread([PREFIX + "[Log]:"], args));
|
|
592
593
|
});
|
|
593
594
|
};
|
|
594
595
|
/** JSDoc */
|
|
@@ -601,7 +602,8 @@ var Sentry = (function (exports) {
|
|
|
601
602
|
return;
|
|
602
603
|
}
|
|
603
604
|
consoleSandbox(function () {
|
|
604
|
-
|
|
605
|
+
var _a;
|
|
606
|
+
(_a = global$6.console).warn.apply(_a, __spread([PREFIX + "[Warn]:"], args));
|
|
605
607
|
});
|
|
606
608
|
};
|
|
607
609
|
/** JSDoc */
|
|
@@ -614,7 +616,8 @@ var Sentry = (function (exports) {
|
|
|
614
616
|
return;
|
|
615
617
|
}
|
|
616
618
|
consoleSandbox(function () {
|
|
617
|
-
|
|
619
|
+
var _a;
|
|
620
|
+
(_a = global$6.console).error.apply(_a, __spread([PREFIX + "[Error]:"], args));
|
|
618
621
|
});
|
|
619
622
|
};
|
|
620
623
|
return Logger;
|
|
@@ -672,12 +675,13 @@ var Sentry = (function (exports) {
|
|
|
672
675
|
* StackFrames are returned in the correct order for Sentry Exception
|
|
673
676
|
* frames and with Sentry SDK internal frames removed from the top and bottom
|
|
674
677
|
*
|
|
675
|
-
|
|
678
|
+
*/
|
|
676
679
|
function createStackParser() {
|
|
677
680
|
var parsers = [];
|
|
678
681
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
679
682
|
parsers[_i] = arguments[_i];
|
|
680
683
|
}
|
|
684
|
+
var sortedParsers = parsers.sort(function (a, b) { return a[0] - b[0]; }).map(function (p) { return p[1]; });
|
|
681
685
|
return function (stack, skipFirst) {
|
|
682
686
|
var e_1, _a, e_2, _b;
|
|
683
687
|
if (skipFirst === void 0) { skipFirst = 0; }
|
|
@@ -686,8 +690,8 @@ var Sentry = (function (exports) {
|
|
|
686
690
|
for (var _c = __values(stack.split('\n').slice(skipFirst)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
687
691
|
var line = _d.value;
|
|
688
692
|
try {
|
|
689
|
-
for (var
|
|
690
|
-
var parser =
|
|
693
|
+
for (var sortedParsers_1 = (e_2 = void 0, __values(sortedParsers)), sortedParsers_1_1 = sortedParsers_1.next(); !sortedParsers_1_1.done; sortedParsers_1_1 = sortedParsers_1.next()) {
|
|
694
|
+
var parser = sortedParsers_1_1.value;
|
|
691
695
|
var frame = parser(line);
|
|
692
696
|
if (frame) {
|
|
693
697
|
frames.push(frame);
|
|
@@ -698,7 +702,7 @@ var Sentry = (function (exports) {
|
|
|
698
702
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
699
703
|
finally {
|
|
700
704
|
try {
|
|
701
|
-
if (
|
|
705
|
+
if (sortedParsers_1_1 && !sortedParsers_1_1.done && (_b = sortedParsers_1.return)) _b.call(sortedParsers_1);
|
|
702
706
|
}
|
|
703
707
|
finally { if (e_2) throw e_2.error; }
|
|
704
708
|
}
|
|
@@ -990,19 +994,19 @@ var Sentry = (function (exports) {
|
|
|
990
994
|
if (type === '[object Array]') {
|
|
991
995
|
return '[Array]';
|
|
992
996
|
}
|
|
993
|
-
|
|
994
|
-
|
|
997
|
+
// `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
|
|
998
|
+
// pass-through.
|
|
999
|
+
var serializable = makeSerializable(value);
|
|
1000
|
+
return isPrimitive(serializable) ? serializable : type;
|
|
995
1001
|
}
|
|
996
1002
|
/**
|
|
997
|
-
*
|
|
1003
|
+
* makeSerializable()
|
|
998
1004
|
*
|
|
999
|
-
* Takes unserializable input and make it
|
|
1005
|
+
* Takes unserializable input and make it serializer-friendly.
|
|
1000
1006
|
*
|
|
1001
|
-
*
|
|
1002
|
-
* - serializes Error objects
|
|
1003
|
-
* - filter global objects
|
|
1007
|
+
* Handles globals, functions, `undefined`, `NaN`, and other non-serializable values.
|
|
1004
1008
|
*/
|
|
1005
|
-
function
|
|
1009
|
+
function makeSerializable(value, key) {
|
|
1006
1010
|
if (key === 'domain' && value && typeof value === 'object' && value._events) {
|
|
1007
1011
|
return '[Domain]';
|
|
1008
1012
|
}
|
|
@@ -1056,6 +1060,7 @@ var Sentry = (function (exports) {
|
|
|
1056
1060
|
function walk(key, value, depth, memo) {
|
|
1057
1061
|
if (depth === void 0) { depth = +Infinity; }
|
|
1058
1062
|
if (memo === void 0) { memo = memoBuilder(); }
|
|
1063
|
+
var _a = __read(memo, 2), memoize = _a[0], unmemoize = _a[1];
|
|
1059
1064
|
// If we reach the maximum depth, serialize whatever is left
|
|
1060
1065
|
if (depth === 0) {
|
|
1061
1066
|
return serializeValue(value);
|
|
@@ -1066,10 +1071,12 @@ var Sentry = (function (exports) {
|
|
|
1066
1071
|
return value.toJSON();
|
|
1067
1072
|
}
|
|
1068
1073
|
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
|
|
1069
|
-
//
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1074
|
+
// `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
|
|
1075
|
+
// pass-through. If what comes back is a primitive (either because it's been stringified or because it was primitive
|
|
1076
|
+
// all along), we're done.
|
|
1077
|
+
var serializable = makeSerializable(value, key);
|
|
1078
|
+
if (isPrimitive(serializable)) {
|
|
1079
|
+
return serializable;
|
|
1073
1080
|
}
|
|
1074
1081
|
// Create source that we will use for the next iteration. It will either be an objectified error object (`Error` type
|
|
1075
1082
|
// with extracted key:value pairs) or the input itself.
|
|
@@ -1077,7 +1084,7 @@ var Sentry = (function (exports) {
|
|
|
1077
1084
|
// Create an accumulator that will act as a parent for all future itterations of that branch
|
|
1078
1085
|
var acc = Array.isArray(value) ? [] : {};
|
|
1079
1086
|
// If we already walked that branch, bail out, as it's circular reference
|
|
1080
|
-
if (
|
|
1087
|
+
if (memoize(value)) {
|
|
1081
1088
|
return '[Circular ~]';
|
|
1082
1089
|
}
|
|
1083
1090
|
// Walk all keys of the source
|
|
@@ -1087,10 +1094,11 @@ var Sentry = (function (exports) {
|
|
|
1087
1094
|
continue;
|
|
1088
1095
|
}
|
|
1089
1096
|
// Recursively walk through all the child nodes
|
|
1090
|
-
|
|
1097
|
+
var innerValue = source[innerKey];
|
|
1098
|
+
acc[innerKey] = walk(innerKey, innerValue, depth - 1, memo);
|
|
1091
1099
|
}
|
|
1092
1100
|
// Once walked through all the branches, remove the parent from memo storage
|
|
1093
|
-
|
|
1101
|
+
unmemoize(value);
|
|
1094
1102
|
// Return accumulated values
|
|
1095
1103
|
return acc;
|
|
1096
1104
|
}
|
|
@@ -1109,7 +1117,8 @@ var Sentry = (function (exports) {
|
|
|
1109
1117
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1110
1118
|
function normalize(input, depth) {
|
|
1111
1119
|
try {
|
|
1112
|
-
|
|
1120
|
+
// since we're at the outermost level, there is no key
|
|
1121
|
+
return walk('', input, depth);
|
|
1113
1122
|
}
|
|
1114
1123
|
catch (_oO) {
|
|
1115
1124
|
return '**non-serializable**';
|
|
@@ -1223,7 +1232,7 @@ var Sentry = (function (exports) {
|
|
|
1223
1232
|
var result = false;
|
|
1224
1233
|
var doc = global.document;
|
|
1225
1234
|
// eslint-disable-next-line deprecation/deprecation
|
|
1226
|
-
if (doc && typeof doc.createElement ===
|
|
1235
|
+
if (doc && typeof doc.createElement === 'function') {
|
|
1227
1236
|
try {
|
|
1228
1237
|
var sandbox = doc.createElement('iframe');
|
|
1229
1238
|
sandbox.hidden = true;
|
|
@@ -1355,7 +1364,7 @@ var Sentry = (function (exports) {
|
|
|
1355
1364
|
}
|
|
1356
1365
|
catch (e) {
|
|
1357
1366
|
if (isDebugBuild()) {
|
|
1358
|
-
logger.error("Error while triggering instrumentation handler.\nType: " + type + "\nName: " + getFunctionName(handler) + "\nError:
|
|
1367
|
+
logger.error("Error while triggering instrumentation handler.\nType: " + type + "\nName: " + getFunctionName(handler) + "\nError:", e);
|
|
1359
1368
|
}
|
|
1360
1369
|
}
|
|
1361
1370
|
}
|
|
@@ -1922,26 +1931,6 @@ var Sentry = (function (exports) {
|
|
|
1922
1931
|
firstException.mechanism.data = mergedData;
|
|
1923
1932
|
}
|
|
1924
1933
|
}
|
|
1925
|
-
var defaultRetryAfter = 60 * 1000; // 60 seconds
|
|
1926
|
-
/**
|
|
1927
|
-
* Extracts Retry-After value from the request header or returns default value
|
|
1928
|
-
* @param now current unix timestamp
|
|
1929
|
-
* @param header string representation of 'Retry-After' header
|
|
1930
|
-
*/
|
|
1931
|
-
function parseRetryAfterHeader(now, header) {
|
|
1932
|
-
if (!header) {
|
|
1933
|
-
return defaultRetryAfter;
|
|
1934
|
-
}
|
|
1935
|
-
var headerDelay = parseInt("" + header, 10);
|
|
1936
|
-
if (!isNaN(headerDelay)) {
|
|
1937
|
-
return headerDelay * 1000;
|
|
1938
|
-
}
|
|
1939
|
-
var headerDate = Date.parse("" + header);
|
|
1940
|
-
if (!isNaN(headerDate)) {
|
|
1941
|
-
return headerDate - now;
|
|
1942
|
-
}
|
|
1943
|
-
return defaultRetryAfter;
|
|
1944
|
-
}
|
|
1945
1934
|
/**
|
|
1946
1935
|
* Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
|
|
1947
1936
|
* in question), and marks it captured if not.
|
|
@@ -2377,6 +2366,70 @@ var Sentry = (function (exports) {
|
|
|
2377
2366
|
return dateNow;
|
|
2378
2367
|
}))();
|
|
2379
2368
|
|
|
2369
|
+
/**
|
|
2370
|
+
* Creates an envelope.
|
|
2371
|
+
* Make sure to always explicitly provide the generic to this function
|
|
2372
|
+
* so that the envelope types resolve correctly.
|
|
2373
|
+
*/
|
|
2374
|
+
function createEnvelope(headers, items) {
|
|
2375
|
+
if (items === void 0) { items = []; }
|
|
2376
|
+
return [headers, items];
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Serializes an envelope into a string.
|
|
2380
|
+
*/
|
|
2381
|
+
function serializeEnvelope(envelope) {
|
|
2382
|
+
var _a = __read(envelope, 2), headers = _a[0], items = _a[1];
|
|
2383
|
+
var serializedHeaders = JSON.stringify(headers);
|
|
2384
|
+
// Have to cast items to any here since Envelope is a union type
|
|
2385
|
+
// Fixed in Typescript 4.2
|
|
2386
|
+
// TODO: Remove any[] cast when we upgrade to TS 4.2
|
|
2387
|
+
// https://github.com/microsoft/TypeScript/issues/36390
|
|
2388
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2389
|
+
return items.reduce(function (acc, item) {
|
|
2390
|
+
var _a = __read(item, 2), itemHeaders = _a[0], payload = _a[1];
|
|
2391
|
+
// We do not serialize payloads that are primitives
|
|
2392
|
+
var serializedPayload = isPrimitive(payload) ? String(payload) : JSON.stringify(payload);
|
|
2393
|
+
return acc + "\n" + JSON.stringify(itemHeaders) + "\n" + serializedPayload;
|
|
2394
|
+
}, serializedHeaders);
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* Creates client report envelope
|
|
2399
|
+
* @param discarded_events An array of discard events
|
|
2400
|
+
* @param dsn A DSN that can be set on the header. Optional.
|
|
2401
|
+
*/
|
|
2402
|
+
function createClientReportEnvelope(discarded_events, dsn, timestamp) {
|
|
2403
|
+
var clientReportItem = [
|
|
2404
|
+
{ type: 'client_report' },
|
|
2405
|
+
{
|
|
2406
|
+
timestamp: timestamp || dateTimestampInSeconds(),
|
|
2407
|
+
discarded_events: discarded_events,
|
|
2408
|
+
},
|
|
2409
|
+
];
|
|
2410
|
+
return createEnvelope(dsn ? { dsn: dsn } : {}, [clientReportItem]);
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
var DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds
|
|
2414
|
+
/**
|
|
2415
|
+
* Extracts Retry-After value from the request header or returns default value
|
|
2416
|
+
* @param header string representation of 'Retry-After' header
|
|
2417
|
+
* @param now current unix timestamp
|
|
2418
|
+
*
|
|
2419
|
+
*/
|
|
2420
|
+
function parseRetryAfterHeader(header, now) {
|
|
2421
|
+
if (now === void 0) { now = Date.now(); }
|
|
2422
|
+
var headerDelay = parseInt("" + header, 10);
|
|
2423
|
+
if (!isNaN(headerDelay)) {
|
|
2424
|
+
return headerDelay * 1000;
|
|
2425
|
+
}
|
|
2426
|
+
var headerDate = Date.parse("" + header);
|
|
2427
|
+
if (!isNaN(headerDate)) {
|
|
2428
|
+
return headerDate - now;
|
|
2429
|
+
}
|
|
2430
|
+
return DEFAULT_RETRY_AFTER;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2380
2433
|
/**
|
|
2381
2434
|
* Absolute maximum number of breadcrumbs added to an event.
|
|
2382
2435
|
* The `maxBreadcrumbs` option cannot be higher than this value.
|
|
@@ -4250,7 +4303,7 @@ var Sentry = (function (exports) {
|
|
|
4250
4303
|
*/
|
|
4251
4304
|
NoopTransport.prototype.sendEvent = function (_) {
|
|
4252
4305
|
return resolvedSyncPromise({
|
|
4253
|
-
reason:
|
|
4306
|
+
reason: 'NoopTransport: Event has been skipped because no Dsn is configured.',
|
|
4254
4307
|
status: 'skipped',
|
|
4255
4308
|
});
|
|
4256
4309
|
};
|
|
@@ -4295,7 +4348,7 @@ var Sentry = (function (exports) {
|
|
|
4295
4348
|
BaseBackend.prototype.sendEvent = function (event) {
|
|
4296
4349
|
void this._transport.sendEvent(event).then(null, function (reason) {
|
|
4297
4350
|
if (isDebugBuild()) {
|
|
4298
|
-
logger.error(
|
|
4351
|
+
logger.error('Error while sending event:', reason);
|
|
4299
4352
|
}
|
|
4300
4353
|
});
|
|
4301
4354
|
};
|
|
@@ -4311,7 +4364,7 @@ var Sentry = (function (exports) {
|
|
|
4311
4364
|
}
|
|
4312
4365
|
void this._transport.sendSession(session).then(null, function (reason) {
|
|
4313
4366
|
if (isDebugBuild()) {
|
|
4314
|
-
logger.error(
|
|
4367
|
+
logger.error('Error while sending session:', reason);
|
|
4315
4368
|
}
|
|
4316
4369
|
});
|
|
4317
4370
|
};
|
|
@@ -4356,14 +4409,14 @@ var Sentry = (function (exports) {
|
|
|
4356
4409
|
/** Creates a SentryRequest from a Session. */
|
|
4357
4410
|
function sessionToSentryRequest(session, api) {
|
|
4358
4411
|
var sdkInfo = getSdkMetadataForEnvelopeHeader(api);
|
|
4359
|
-
var envelopeHeaders =
|
|
4360
|
-
// I know this is hacky but we don't want to add `
|
|
4412
|
+
var envelopeHeaders = __assign(__assign({ sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
|
|
4413
|
+
// I know this is hacky but we don't want to add `sessions` to request type since it's never rate limited
|
|
4361
4414
|
var type = 'aggregates' in session ? 'sessions' : 'session';
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4415
|
+
// TODO (v7) Have to cast type because envelope items do not accept a `SentryRequestType`
|
|
4416
|
+
var envelopeItem = [{ type: type }, session];
|
|
4417
|
+
var envelope = createEnvelope(envelopeHeaders, [envelopeItem]);
|
|
4365
4418
|
return {
|
|
4366
|
-
body:
|
|
4419
|
+
body: serializeEnvelope(envelope),
|
|
4367
4420
|
type: type,
|
|
4368
4421
|
url: getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel),
|
|
4369
4422
|
};
|
|
@@ -4441,19 +4494,16 @@ var Sentry = (function (exports) {
|
|
|
4441
4494
|
// deserialization. Instead, we only implement a minimal subset of the spec to
|
|
4442
4495
|
// serialize events inline here.
|
|
4443
4496
|
if (useEnvelope) {
|
|
4444
|
-
var envelopeHeaders =
|
|
4445
|
-
var
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
// const envelope = `${envelopeHeaders}\n${itemHeaders}\n${req.body}\n`;
|
|
4455
|
-
var envelope = envelopeHeaders + "\n" + itemHeaders + "\n" + req.body;
|
|
4456
|
-
req.body = envelope;
|
|
4497
|
+
var envelopeHeaders = __assign(__assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
|
|
4498
|
+
var eventItem = [
|
|
4499
|
+
{
|
|
4500
|
+
type: eventType,
|
|
4501
|
+
sample_rates: [{ id: samplingMethod, rate: sampleRate }],
|
|
4502
|
+
},
|
|
4503
|
+
req.body,
|
|
4504
|
+
];
|
|
4505
|
+
var envelope = createEnvelope(envelopeHeaders, [eventItem]);
|
|
4506
|
+
req.body = serializeEnvelope(envelope);
|
|
4457
4507
|
}
|
|
4458
4508
|
return req;
|
|
4459
4509
|
}
|
|
@@ -4478,7 +4528,7 @@ var Sentry = (function (exports) {
|
|
|
4478
4528
|
hub.bindClient(client);
|
|
4479
4529
|
}
|
|
4480
4530
|
|
|
4481
|
-
var SDK_VERSION = '6.18.
|
|
4531
|
+
var SDK_VERSION = '6.18.2';
|
|
4482
4532
|
|
|
4483
4533
|
var originalFunctionToString;
|
|
4484
4534
|
/** Patch toString calls to return proper name for wrapped functions */
|
|
@@ -4701,6 +4751,11 @@ var Sentry = (function (exports) {
|
|
|
4701
4751
|
|
|
4702
4752
|
// global reference to slice
|
|
4703
4753
|
var UNKNOWN_FUNCTION = '?';
|
|
4754
|
+
var OPERA10_PRIORITY = 10;
|
|
4755
|
+
var OPERA11_PRIORITY = 20;
|
|
4756
|
+
var CHROME_PRIORITY = 30;
|
|
4757
|
+
var WINJS_PRIORITY = 40;
|
|
4758
|
+
var GECKO_PRIORITY = 50;
|
|
4704
4759
|
function createFrame(filename, func, lineno, colno) {
|
|
4705
4760
|
var frame = {
|
|
4706
4761
|
filename: filename,
|
|
@@ -4739,6 +4794,7 @@ var Sentry = (function (exports) {
|
|
|
4739
4794
|
}
|
|
4740
4795
|
return;
|
|
4741
4796
|
};
|
|
4797
|
+
var chromeStackParser = [CHROME_PRIORITY, chrome];
|
|
4742
4798
|
// gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
|
|
4743
4799
|
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
|
|
4744
4800
|
// We need this specific case for now because we want no other regex to match.
|
|
@@ -4753,7 +4809,7 @@ var Sentry = (function (exports) {
|
|
|
4753
4809
|
var subMatch = geckoEvalRegex.exec(parts[3]);
|
|
4754
4810
|
if (subMatch) {
|
|
4755
4811
|
// throw out eval line/column and use top-most line number
|
|
4756
|
-
parts[1] = parts[1] ||
|
|
4812
|
+
parts[1] = parts[1] || 'eval';
|
|
4757
4813
|
parts[3] = subMatch[1];
|
|
4758
4814
|
parts[4] = subMatch[2];
|
|
4759
4815
|
parts[5] = ''; // no column when eval
|
|
@@ -4766,6 +4822,7 @@ var Sentry = (function (exports) {
|
|
|
4766
4822
|
}
|
|
4767
4823
|
return;
|
|
4768
4824
|
};
|
|
4825
|
+
var geckoStackParser = [GECKO_PRIORITY, gecko];
|
|
4769
4826
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
4770
4827
|
var winjs = function (line) {
|
|
4771
4828
|
var parts = winjsRegex.exec(line);
|
|
@@ -4773,16 +4830,19 @@ var Sentry = (function (exports) {
|
|
|
4773
4830
|
? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)
|
|
4774
4831
|
: undefined;
|
|
4775
4832
|
};
|
|
4833
|
+
var winjsStackParser = [WINJS_PRIORITY, winjs];
|
|
4776
4834
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
4777
4835
|
var opera10 = function (line) {
|
|
4778
4836
|
var parts = opera10Regex.exec(line);
|
|
4779
4837
|
return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;
|
|
4780
4838
|
};
|
|
4839
|
+
var opera10StackParser = [OPERA10_PRIORITY, opera10];
|
|
4781
4840
|
var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
|
|
4782
4841
|
var opera11 = function (line) {
|
|
4783
4842
|
var parts = opera11Regex.exec(line);
|
|
4784
4843
|
return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
4785
4844
|
};
|
|
4845
|
+
var opera11StackParser = [OPERA11_PRIORITY, opera11];
|
|
4786
4846
|
/**
|
|
4787
4847
|
* Safari web extensions, starting version unknown, can produce "frames-only" stacktraces.
|
|
4788
4848
|
* What it means, is that instead of format like:
|
|
@@ -4826,7 +4886,7 @@ var Sentry = (function (exports) {
|
|
|
4826
4886
|
type: ex && ex.name,
|
|
4827
4887
|
value: extractMessage(ex),
|
|
4828
4888
|
};
|
|
4829
|
-
if (frames
|
|
4889
|
+
if (frames.length) {
|
|
4830
4890
|
exception.stacktrace = { frames: frames };
|
|
4831
4891
|
}
|
|
4832
4892
|
if (exception.type === undefined && exception.value === '') {
|
|
@@ -4837,13 +4897,13 @@ var Sentry = (function (exports) {
|
|
|
4837
4897
|
/**
|
|
4838
4898
|
* @hidden
|
|
4839
4899
|
*/
|
|
4840
|
-
function eventFromPlainObject(exception, syntheticException,
|
|
4900
|
+
function eventFromPlainObject(exception, syntheticException, isUnhandledRejection) {
|
|
4841
4901
|
var event = {
|
|
4842
4902
|
exception: {
|
|
4843
4903
|
values: [
|
|
4844
4904
|
{
|
|
4845
|
-
type: isEvent(exception) ? exception.constructor.name :
|
|
4846
|
-
value: "Non-Error " + (
|
|
4905
|
+
type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',
|
|
4906
|
+
value: "Non-Error " + (isUnhandledRejection ? 'promise rejection' : 'exception') + " captured with keys: " + extractExceptionKeysForMessage(exception),
|
|
4847
4907
|
},
|
|
4848
4908
|
],
|
|
4849
4909
|
},
|
|
@@ -4877,8 +4937,7 @@ var Sentry = (function (exports) {
|
|
|
4877
4937
|
var stacktrace = ex.stacktrace || ex.stack || '';
|
|
4878
4938
|
var popSize = getPopSize(ex);
|
|
4879
4939
|
try {
|
|
4880
|
-
|
|
4881
|
-
return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);
|
|
4940
|
+
return createStackParser(opera10StackParser, opera11StackParser, chromeStackParser, winjsStackParser, geckoStackParser)(stacktrace, popSize);
|
|
4882
4941
|
}
|
|
4883
4942
|
catch (e) {
|
|
4884
4943
|
// no-empty
|
|
@@ -4903,7 +4962,6 @@ var Sentry = (function (exports) {
|
|
|
4903
4962
|
* https://github.com/getsentry/sentry-javascript/issues/1949
|
|
4904
4963
|
* In this specific case we try to extract stacktrace.message.error.message
|
|
4905
4964
|
*/
|
|
4906
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4907
4965
|
function extractMessage(ex) {
|
|
4908
4966
|
var message = ex && ex.message;
|
|
4909
4967
|
if (!message) {
|
|
@@ -4913,17 +4971,14 @@ var Sentry = (function (exports) {
|
|
|
4913
4971
|
return message.error.message;
|
|
4914
4972
|
}
|
|
4915
4973
|
return message;
|
|
4916
|
-
}
|
|
4917
|
-
|
|
4974
|
+
}
|
|
4918
4975
|
/**
|
|
4919
4976
|
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
4920
4977
|
* @hidden
|
|
4921
4978
|
*/
|
|
4922
|
-
function eventFromException(
|
|
4979
|
+
function eventFromException(exception, hint, attachStacktrace) {
|
|
4923
4980
|
var syntheticException = (hint && hint.syntheticException) || undefined;
|
|
4924
|
-
var event = eventFromUnknownInput(exception, syntheticException,
|
|
4925
|
-
attachStacktrace: options.attachStacktrace,
|
|
4926
|
-
});
|
|
4981
|
+
var event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);
|
|
4927
4982
|
addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
|
|
4928
4983
|
event.level = exports.Severity.Error;
|
|
4929
4984
|
if (hint && hint.event_id) {
|
|
@@ -4935,12 +4990,10 @@ var Sentry = (function (exports) {
|
|
|
4935
4990
|
* Builds and Event from a Message
|
|
4936
4991
|
* @hidden
|
|
4937
4992
|
*/
|
|
4938
|
-
function eventFromMessage(
|
|
4993
|
+
function eventFromMessage(message, level, hint, attachStacktrace) {
|
|
4939
4994
|
if (level === void 0) { level = exports.Severity.Info; }
|
|
4940
4995
|
var syntheticException = (hint && hint.syntheticException) || undefined;
|
|
4941
|
-
var event = eventFromString(message, syntheticException,
|
|
4942
|
-
attachStacktrace: options.attachStacktrace,
|
|
4943
|
-
});
|
|
4996
|
+
var event = eventFromString(message, syntheticException, attachStacktrace);
|
|
4944
4997
|
event.level = level;
|
|
4945
4998
|
if (hint && hint.event_id) {
|
|
4946
4999
|
event.event_id = hint.event_id;
|
|
@@ -4950,8 +5003,7 @@ var Sentry = (function (exports) {
|
|
|
4950
5003
|
/**
|
|
4951
5004
|
* @hidden
|
|
4952
5005
|
*/
|
|
4953
|
-
function eventFromUnknownInput(exception, syntheticException,
|
|
4954
|
-
if (options === void 0) { options = {}; }
|
|
5006
|
+
function eventFromUnknownInput(exception, syntheticException, attachStacktrace, isUnhandledRejection) {
|
|
4955
5007
|
var event;
|
|
4956
5008
|
if (isErrorEvent(exception) && exception.error) {
|
|
4957
5009
|
// If it is an ErrorEvent with `error` property, extract it to get actual Error
|
|
@@ -4973,7 +5025,7 @@ var Sentry = (function (exports) {
|
|
|
4973
5025
|
else {
|
|
4974
5026
|
var name_1 = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
|
|
4975
5027
|
var message = domException.message ? name_1 + ": " + domException.message : name_1;
|
|
4976
|
-
event = eventFromString(message, syntheticException,
|
|
5028
|
+
event = eventFromString(message, syntheticException, attachStacktrace);
|
|
4977
5029
|
addExceptionTypeValue(event, message);
|
|
4978
5030
|
}
|
|
4979
5031
|
if ('code' in domException) {
|
|
@@ -4990,7 +5042,7 @@ var Sentry = (function (exports) {
|
|
|
4990
5042
|
// it manually. This will allow us to group events based on top-level keys which is much better than creating a new
|
|
4991
5043
|
// group on any key/value change.
|
|
4992
5044
|
var objectException = exception;
|
|
4993
|
-
event = eventFromPlainObject(objectException, syntheticException,
|
|
5045
|
+
event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);
|
|
4994
5046
|
addExceptionMechanism(event, {
|
|
4995
5047
|
synthetic: true,
|
|
4996
5048
|
});
|
|
@@ -5005,7 +5057,7 @@ var Sentry = (function (exports) {
|
|
|
5005
5057
|
// - a plain Object
|
|
5006
5058
|
//
|
|
5007
5059
|
// So bail out and capture it as a simple message:
|
|
5008
|
-
event = eventFromString(exception, syntheticException,
|
|
5060
|
+
event = eventFromString(exception, syntheticException, attachStacktrace);
|
|
5009
5061
|
addExceptionTypeValue(event, "" + exception, undefined);
|
|
5010
5062
|
addExceptionMechanism(event, {
|
|
5011
5063
|
synthetic: true,
|
|
@@ -5015,15 +5067,14 @@ var Sentry = (function (exports) {
|
|
|
5015
5067
|
/**
|
|
5016
5068
|
* @hidden
|
|
5017
5069
|
*/
|
|
5018
|
-
function eventFromString(input, syntheticException,
|
|
5019
|
-
if (options === void 0) { options = {}; }
|
|
5070
|
+
function eventFromString(input, syntheticException, attachStacktrace) {
|
|
5020
5071
|
var event = {
|
|
5021
5072
|
message: input,
|
|
5022
5073
|
};
|
|
5023
|
-
if (
|
|
5024
|
-
var
|
|
5025
|
-
if (
|
|
5026
|
-
event.stacktrace = { frames:
|
|
5074
|
+
if (attachStacktrace && syntheticException) {
|
|
5075
|
+
var frames_2 = parseStackFrames(syntheticException);
|
|
5076
|
+
if (frames_2.length) {
|
|
5077
|
+
event.stacktrace = { frames: frames_2 };
|
|
5027
5078
|
}
|
|
5028
5079
|
}
|
|
5029
5080
|
return event;
|
|
@@ -5081,7 +5132,7 @@ var Sentry = (function (exports) {
|
|
|
5081
5132
|
var document = global$4.document;
|
|
5082
5133
|
var fetchImpl = global$4.fetch;
|
|
5083
5134
|
// eslint-disable-next-line deprecation/deprecation
|
|
5084
|
-
if (document && typeof document.createElement ===
|
|
5135
|
+
if (document && typeof document.createElement === 'function') {
|
|
5085
5136
|
try {
|
|
5086
5137
|
var sandbox = document.createElement('iframe');
|
|
5087
5138
|
sandbox.hidden = true;
|
|
@@ -5203,25 +5254,18 @@ var Sentry = (function (exports) {
|
|
|
5203
5254
|
}
|
|
5204
5255
|
logger.log("Flushing outcomes:\n" + JSON.stringify(outcomes, null, 2));
|
|
5205
5256
|
var url = getEnvelopeEndpointWithUrlEncodedAuth(this._api.dsn, this._api.tunnel);
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
var _a = __read(key.split(':'), 2), category = _a[0], reason = _a[1];
|
|
5215
|
-
return {
|
|
5216
|
-
reason: reason,
|
|
5217
|
-
category: category,
|
|
5218
|
-
quantity: outcomes[key],
|
|
5219
|
-
};
|
|
5220
|
-
}),
|
|
5257
|
+
var discardedEvents = Object.keys(outcomes).map(function (key) {
|
|
5258
|
+
var _a = __read(key.split(':'), 2), category = _a[0], reason = _a[1];
|
|
5259
|
+
return {
|
|
5260
|
+
reason: reason,
|
|
5261
|
+
category: category,
|
|
5262
|
+
quantity: outcomes[key],
|
|
5263
|
+
};
|
|
5264
|
+
// TODO: Improve types on discarded_events to get rid of cast
|
|
5221
5265
|
});
|
|
5222
|
-
var envelope =
|
|
5266
|
+
var envelope = createClientReportEnvelope(discardedEvents, this._api.tunnel && dsnToString(this._api.dsn));
|
|
5223
5267
|
try {
|
|
5224
|
-
sendReport(url, envelope);
|
|
5268
|
+
sendReport(url, serializeEnvelope(envelope));
|
|
5225
5269
|
}
|
|
5226
5270
|
catch (e) {
|
|
5227
5271
|
logger.error(e);
|
|
@@ -5310,7 +5354,7 @@ var Sentry = (function (exports) {
|
|
|
5310
5354
|
return true;
|
|
5311
5355
|
}
|
|
5312
5356
|
else if (raHeader) {
|
|
5313
|
-
this._rateLimits.all = new Date(now + parseRetryAfterHeader(
|
|
5357
|
+
this._rateLimits.all = new Date(now + parseRetryAfterHeader(raHeader, now));
|
|
5314
5358
|
return true;
|
|
5315
5359
|
}
|
|
5316
5360
|
return false;
|
|
@@ -5468,14 +5512,14 @@ var Sentry = (function (exports) {
|
|
|
5468
5512
|
* @inheritDoc
|
|
5469
5513
|
*/
|
|
5470
5514
|
BrowserBackend.prototype.eventFromException = function (exception, hint) {
|
|
5471
|
-
return eventFromException(
|
|
5515
|
+
return eventFromException(exception, hint, this._options.attachStacktrace);
|
|
5472
5516
|
};
|
|
5473
5517
|
/**
|
|
5474
5518
|
* @inheritDoc
|
|
5475
5519
|
*/
|
|
5476
5520
|
BrowserBackend.prototype.eventFromMessage = function (message, level, hint) {
|
|
5477
5521
|
if (level === void 0) { level = exports.Severity.Info; }
|
|
5478
|
-
return eventFromMessage(
|
|
5522
|
+
return eventFromMessage(message, level, hint, this._options.attachStacktrace);
|
|
5479
5523
|
};
|
|
5480
5524
|
/**
|
|
5481
5525
|
* @inheritDoc
|
|
@@ -5625,13 +5669,13 @@ var Sentry = (function (exports) {
|
|
|
5625
5669
|
}
|
|
5626
5670
|
if (!options.eventId) {
|
|
5627
5671
|
if (isDebugBuild()) {
|
|
5628
|
-
logger.error(
|
|
5672
|
+
logger.error('Missing eventId option in showReportDialog call');
|
|
5629
5673
|
}
|
|
5630
5674
|
return;
|
|
5631
5675
|
}
|
|
5632
5676
|
if (!options.dsn) {
|
|
5633
5677
|
if (isDebugBuild()) {
|
|
5634
|
-
logger.error(
|
|
5678
|
+
logger.error('Missing dsn option in showReportDialog call');
|
|
5635
5679
|
}
|
|
5636
5680
|
return;
|
|
5637
5681
|
}
|
|
@@ -5705,10 +5749,7 @@ var Sentry = (function (exports) {
|
|
|
5705
5749
|
}
|
|
5706
5750
|
var event = error === undefined && isString(msg)
|
|
5707
5751
|
? _eventFromIncompleteOnError(msg, url, line, column)
|
|
5708
|
-
: _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined,
|
|
5709
|
-
attachStacktrace: attachStacktrace,
|
|
5710
|
-
isRejection: false,
|
|
5711
|
-
}), url, line, column);
|
|
5752
|
+
: _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined, attachStacktrace, false), url, line, column);
|
|
5712
5753
|
event.level = exports.Severity.Error;
|
|
5713
5754
|
addMechanismAndCapture(hub, error, event, 'onerror');
|
|
5714
5755
|
});
|
|
@@ -5747,10 +5788,7 @@ var Sentry = (function (exports) {
|
|
|
5747
5788
|
}
|
|
5748
5789
|
var event = isPrimitive(error)
|
|
5749
5790
|
? _eventFromRejectionWithPrimitive(error)
|
|
5750
|
-
: eventFromUnknownInput(error, undefined,
|
|
5751
|
-
attachStacktrace: attachStacktrace,
|
|
5752
|
-
isRejection: true,
|
|
5753
|
-
});
|
|
5791
|
+
: eventFromUnknownInput(error, undefined, attachStacktrace, true);
|
|
5754
5792
|
event.level = exports.Severity.Error;
|
|
5755
5793
|
addMechanismAndCapture(hub, error, event, 'onunhandledrejection');
|
|
5756
5794
|
return;
|
|
@@ -6406,7 +6444,7 @@ var Sentry = (function (exports) {
|
|
|
6406
6444
|
// Juuust in case something goes wrong
|
|
6407
6445
|
try {
|
|
6408
6446
|
if (_shouldDropEvent(currentEvent, self._previousEvent)) {
|
|
6409
|
-
logger.warn(
|
|
6447
|
+
logger.warn('Event dropped due to being a duplicate of previously captured event.');
|
|
6410
6448
|
return null;
|
|
6411
6449
|
}
|
|
6412
6450
|
}
|