@sentry/browser 6.18.1 → 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 +108 -107
- 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 +117 -114
- 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.js +1 -1
- 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.js +1 -1
- 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.es6.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
|
/**
|
|
@@ -501,7 +501,7 @@ var Sentry = (function (exports) {
|
|
|
501
501
|
return;
|
|
502
502
|
}
|
|
503
503
|
consoleSandbox(() => {
|
|
504
|
-
global$6.console.log(`${PREFIX}[Log]
|
|
504
|
+
global$6.console.log(`${PREFIX}[Log]:`, ...args);
|
|
505
505
|
});
|
|
506
506
|
}
|
|
507
507
|
/** JSDoc */
|
|
@@ -510,7 +510,7 @@ var Sentry = (function (exports) {
|
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
512
512
|
consoleSandbox(() => {
|
|
513
|
-
global$6.console.warn(`${PREFIX}[Warn]
|
|
513
|
+
global$6.console.warn(`${PREFIX}[Warn]:`, ...args);
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
516
|
/** JSDoc */
|
|
@@ -519,7 +519,7 @@ var Sentry = (function (exports) {
|
|
|
519
519
|
return;
|
|
520
520
|
}
|
|
521
521
|
consoleSandbox(() => {
|
|
522
|
-
global$6.console.error(`${PREFIX}[Error]
|
|
522
|
+
global$6.console.error(`${PREFIX}[Error]:`, ...args);
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
525
|
}
|
|
@@ -576,12 +576,13 @@ var Sentry = (function (exports) {
|
|
|
576
576
|
* StackFrames are returned in the correct order for Sentry Exception
|
|
577
577
|
* frames and with Sentry SDK internal frames removed from the top and bottom
|
|
578
578
|
*
|
|
579
|
-
|
|
579
|
+
*/
|
|
580
580
|
function createStackParser(...parsers) {
|
|
581
|
+
const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]);
|
|
581
582
|
return (stack, skipFirst = 0) => {
|
|
582
583
|
const frames = [];
|
|
583
584
|
for (const line of stack.split('\n').slice(skipFirst)) {
|
|
584
|
-
for (const parser of
|
|
585
|
+
for (const parser of sortedParsers) {
|
|
585
586
|
const frame = parser(line);
|
|
586
587
|
if (frame) {
|
|
587
588
|
frames.push(frame);
|
|
@@ -865,19 +866,19 @@ var Sentry = (function (exports) {
|
|
|
865
866
|
if (type === '[object Array]') {
|
|
866
867
|
return '[Array]';
|
|
867
868
|
}
|
|
868
|
-
|
|
869
|
-
|
|
869
|
+
// `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
|
|
870
|
+
// pass-through.
|
|
871
|
+
const serializable = makeSerializable(value);
|
|
872
|
+
return isPrimitive(serializable) ? serializable : type;
|
|
870
873
|
}
|
|
871
874
|
/**
|
|
872
|
-
*
|
|
875
|
+
* makeSerializable()
|
|
873
876
|
*
|
|
874
|
-
* Takes unserializable input and make it
|
|
877
|
+
* Takes unserializable input and make it serializer-friendly.
|
|
875
878
|
*
|
|
876
|
-
*
|
|
877
|
-
* - serializes Error objects
|
|
878
|
-
* - filter global objects
|
|
879
|
+
* Handles globals, functions, `undefined`, `NaN`, and other non-serializable values.
|
|
879
880
|
*/
|
|
880
|
-
function
|
|
881
|
+
function makeSerializable(value, key) {
|
|
881
882
|
if (key === 'domain' && value && typeof value === 'object' && value._events) {
|
|
882
883
|
return '[Domain]';
|
|
883
884
|
}
|
|
@@ -929,6 +930,7 @@ var Sentry = (function (exports) {
|
|
|
929
930
|
*/
|
|
930
931
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
931
932
|
function walk(key, value, depth = +Infinity, memo = memoBuilder()) {
|
|
933
|
+
const [memoize, unmemoize] = memo;
|
|
932
934
|
// If we reach the maximum depth, serialize whatever is left
|
|
933
935
|
if (depth === 0) {
|
|
934
936
|
return serializeValue(value);
|
|
@@ -939,10 +941,12 @@ var Sentry = (function (exports) {
|
|
|
939
941
|
return value.toJSON();
|
|
940
942
|
}
|
|
941
943
|
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
|
|
942
|
-
//
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
944
|
+
// `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
|
|
945
|
+
// pass-through. If what comes back is a primitive (either because it's been stringified or because it was primitive
|
|
946
|
+
// all along), we're done.
|
|
947
|
+
const serializable = makeSerializable(value, key);
|
|
948
|
+
if (isPrimitive(serializable)) {
|
|
949
|
+
return serializable;
|
|
946
950
|
}
|
|
947
951
|
// Create source that we will use for the next iteration. It will either be an objectified error object (`Error` type
|
|
948
952
|
// with extracted key:value pairs) or the input itself.
|
|
@@ -950,7 +954,7 @@ var Sentry = (function (exports) {
|
|
|
950
954
|
// Create an accumulator that will act as a parent for all future itterations of that branch
|
|
951
955
|
const acc = Array.isArray(value) ? [] : {};
|
|
952
956
|
// If we already walked that branch, bail out, as it's circular reference
|
|
953
|
-
if (
|
|
957
|
+
if (memoize(value)) {
|
|
954
958
|
return '[Circular ~]';
|
|
955
959
|
}
|
|
956
960
|
// Walk all keys of the source
|
|
@@ -960,10 +964,11 @@ var Sentry = (function (exports) {
|
|
|
960
964
|
continue;
|
|
961
965
|
}
|
|
962
966
|
// Recursively walk through all the child nodes
|
|
963
|
-
|
|
967
|
+
const innerValue = source[innerKey];
|
|
968
|
+
acc[innerKey] = walk(innerKey, innerValue, depth - 1, memo);
|
|
964
969
|
}
|
|
965
970
|
// Once walked through all the branches, remove the parent from memo storage
|
|
966
|
-
|
|
971
|
+
unmemoize(value);
|
|
967
972
|
// Return accumulated values
|
|
968
973
|
return acc;
|
|
969
974
|
}
|
|
@@ -982,7 +987,8 @@ var Sentry = (function (exports) {
|
|
|
982
987
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
983
988
|
function normalize(input, depth) {
|
|
984
989
|
try {
|
|
985
|
-
|
|
990
|
+
// since we're at the outermost level, there is no key
|
|
991
|
+
return walk('', input, depth);
|
|
986
992
|
}
|
|
987
993
|
catch (_oO) {
|
|
988
994
|
return '**non-serializable**';
|
|
@@ -1084,7 +1090,7 @@ var Sentry = (function (exports) {
|
|
|
1084
1090
|
let result = false;
|
|
1085
1091
|
const doc = global.document;
|
|
1086
1092
|
// eslint-disable-next-line deprecation/deprecation
|
|
1087
|
-
if (doc && typeof doc.createElement ===
|
|
1093
|
+
if (doc && typeof doc.createElement === 'function') {
|
|
1088
1094
|
try {
|
|
1089
1095
|
const sandbox = doc.createElement('iframe');
|
|
1090
1096
|
sandbox.hidden = true;
|
|
@@ -1213,7 +1219,7 @@ var Sentry = (function (exports) {
|
|
|
1213
1219
|
}
|
|
1214
1220
|
catch (e) {
|
|
1215
1221
|
if (isDebugBuild()) {
|
|
1216
|
-
logger.error(`Error while triggering instrumentation handler.\nType: ${type}\nName: ${getFunctionName(handler)}\nError
|
|
1222
|
+
logger.error(`Error while triggering instrumentation handler.\nType: ${type}\nName: ${getFunctionName(handler)}\nError:`, e);
|
|
1217
1223
|
}
|
|
1218
1224
|
}
|
|
1219
1225
|
}
|
|
@@ -1741,26 +1747,6 @@ var Sentry = (function (exports) {
|
|
|
1741
1747
|
firstException.mechanism.data = mergedData;
|
|
1742
1748
|
}
|
|
1743
1749
|
}
|
|
1744
|
-
const defaultRetryAfter = 60 * 1000; // 60 seconds
|
|
1745
|
-
/**
|
|
1746
|
-
* Extracts Retry-After value from the request header or returns default value
|
|
1747
|
-
* @param now current unix timestamp
|
|
1748
|
-
* @param header string representation of 'Retry-After' header
|
|
1749
|
-
*/
|
|
1750
|
-
function parseRetryAfterHeader(now, header) {
|
|
1751
|
-
if (!header) {
|
|
1752
|
-
return defaultRetryAfter;
|
|
1753
|
-
}
|
|
1754
|
-
const headerDelay = parseInt(`${header}`, 10);
|
|
1755
|
-
if (!isNaN(headerDelay)) {
|
|
1756
|
-
return headerDelay * 1000;
|
|
1757
|
-
}
|
|
1758
|
-
const headerDate = Date.parse(`${header}`);
|
|
1759
|
-
if (!isNaN(headerDate)) {
|
|
1760
|
-
return headerDate - now;
|
|
1761
|
-
}
|
|
1762
|
-
return defaultRetryAfter;
|
|
1763
|
-
}
|
|
1764
1750
|
/**
|
|
1765
1751
|
* Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
|
|
1766
1752
|
* in question), and marks it captured if not.
|
|
@@ -2211,7 +2197,9 @@ var Sentry = (function (exports) {
|
|
|
2211
2197
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2212
2198
|
return items.reduce((acc, item) => {
|
|
2213
2199
|
const [itemHeaders, payload] = item;
|
|
2214
|
-
|
|
2200
|
+
// We do not serialize payloads that are primitives
|
|
2201
|
+
const serializedPayload = isPrimitive(payload) ? String(payload) : JSON.stringify(payload);
|
|
2202
|
+
return `${acc}\n${JSON.stringify(itemHeaders)}\n${serializedPayload}`;
|
|
2215
2203
|
}, serializedHeaders);
|
|
2216
2204
|
}
|
|
2217
2205
|
|
|
@@ -2231,6 +2219,25 @@ var Sentry = (function (exports) {
|
|
|
2231
2219
|
return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);
|
|
2232
2220
|
}
|
|
2233
2221
|
|
|
2222
|
+
const DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds
|
|
2223
|
+
/**
|
|
2224
|
+
* Extracts Retry-After value from the request header or returns default value
|
|
2225
|
+
* @param header string representation of 'Retry-After' header
|
|
2226
|
+
* @param now current unix timestamp
|
|
2227
|
+
*
|
|
2228
|
+
*/
|
|
2229
|
+
function parseRetryAfterHeader(header, now = Date.now()) {
|
|
2230
|
+
const headerDelay = parseInt(`${header}`, 10);
|
|
2231
|
+
if (!isNaN(headerDelay)) {
|
|
2232
|
+
return headerDelay * 1000;
|
|
2233
|
+
}
|
|
2234
|
+
const headerDate = Date.parse(`${header}`);
|
|
2235
|
+
if (!isNaN(headerDate)) {
|
|
2236
|
+
return headerDate - now;
|
|
2237
|
+
}
|
|
2238
|
+
return DEFAULT_RETRY_AFTER;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2234
2241
|
/**
|
|
2235
2242
|
* Absolute maximum number of breadcrumbs added to an event.
|
|
2236
2243
|
* The `maxBreadcrumbs` option cannot be higher than this value.
|
|
@@ -4059,7 +4066,7 @@ var Sentry = (function (exports) {
|
|
|
4059
4066
|
*/
|
|
4060
4067
|
sendEvent(_) {
|
|
4061
4068
|
return resolvedSyncPromise({
|
|
4062
|
-
reason:
|
|
4069
|
+
reason: 'NoopTransport: Event has been skipped because no Dsn is configured.',
|
|
4063
4070
|
status: 'skipped',
|
|
4064
4071
|
});
|
|
4065
4072
|
}
|
|
@@ -4103,7 +4110,7 @@ var Sentry = (function (exports) {
|
|
|
4103
4110
|
sendEvent(event) {
|
|
4104
4111
|
void this._transport.sendEvent(event).then(null, reason => {
|
|
4105
4112
|
if (isDebugBuild()) {
|
|
4106
|
-
logger.error(
|
|
4113
|
+
logger.error('Error while sending event:', reason);
|
|
4107
4114
|
}
|
|
4108
4115
|
});
|
|
4109
4116
|
}
|
|
@@ -4119,7 +4126,7 @@ var Sentry = (function (exports) {
|
|
|
4119
4126
|
}
|
|
4120
4127
|
void this._transport.sendSession(session).then(null, reason => {
|
|
4121
4128
|
if (isDebugBuild()) {
|
|
4122
|
-
logger.error(
|
|
4129
|
+
logger.error('Error while sending session:', reason);
|
|
4123
4130
|
}
|
|
4124
4131
|
});
|
|
4125
4132
|
}
|
|
@@ -4163,14 +4170,14 @@ var Sentry = (function (exports) {
|
|
|
4163
4170
|
/** Creates a SentryRequest from a Session. */
|
|
4164
4171
|
function sessionToSentryRequest(session, api) {
|
|
4165
4172
|
const sdkInfo = getSdkMetadataForEnvelopeHeader(api);
|
|
4166
|
-
const envelopeHeaders =
|
|
4167
|
-
// I know this is hacky but we don't want to add `
|
|
4173
|
+
const envelopeHeaders = Object.assign(Object.assign({ sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
|
|
4174
|
+
// I know this is hacky but we don't want to add `sessions` to request type since it's never rate limited
|
|
4168
4175
|
const type = 'aggregates' in session ? 'sessions' : 'session';
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4176
|
+
// TODO (v7) Have to cast type because envelope items do not accept a `SentryRequestType`
|
|
4177
|
+
const envelopeItem = [{ type }, session];
|
|
4178
|
+
const envelope = createEnvelope(envelopeHeaders, [envelopeItem]);
|
|
4172
4179
|
return {
|
|
4173
|
-
body:
|
|
4180
|
+
body: serializeEnvelope(envelope),
|
|
4174
4181
|
type,
|
|
4175
4182
|
url: getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel),
|
|
4176
4183
|
};
|
|
@@ -4248,19 +4255,16 @@ var Sentry = (function (exports) {
|
|
|
4248
4255
|
// deserialization. Instead, we only implement a minimal subset of the spec to
|
|
4249
4256
|
// serialize events inline here.
|
|
4250
4257
|
if (useEnvelope) {
|
|
4251
|
-
const envelopeHeaders =
|
|
4252
|
-
const
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
// const envelope = `${envelopeHeaders}\n${itemHeaders}\n${req.body}\n`;
|
|
4262
|
-
const envelope = `${envelopeHeaders}\n${itemHeaders}\n${req.body}`;
|
|
4263
|
-
req.body = envelope;
|
|
4258
|
+
const envelopeHeaders = Object.assign(Object.assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
|
|
4259
|
+
const eventItem = [
|
|
4260
|
+
{
|
|
4261
|
+
type: eventType,
|
|
4262
|
+
sample_rates: [{ id: samplingMethod, rate: sampleRate }],
|
|
4263
|
+
},
|
|
4264
|
+
req.body,
|
|
4265
|
+
];
|
|
4266
|
+
const envelope = createEnvelope(envelopeHeaders, [eventItem]);
|
|
4267
|
+
req.body = serializeEnvelope(envelope);
|
|
4264
4268
|
}
|
|
4265
4269
|
return req;
|
|
4266
4270
|
}
|
|
@@ -4285,7 +4289,7 @@ var Sentry = (function (exports) {
|
|
|
4285
4289
|
hub.bindClient(client);
|
|
4286
4290
|
}
|
|
4287
4291
|
|
|
4288
|
-
const SDK_VERSION = '6.18.
|
|
4292
|
+
const SDK_VERSION = '6.18.2';
|
|
4289
4293
|
|
|
4290
4294
|
let originalFunctionToString;
|
|
4291
4295
|
/** Patch toString calls to return proper name for wrapped functions */
|
|
@@ -4516,6 +4520,11 @@ var Sentry = (function (exports) {
|
|
|
4516
4520
|
|
|
4517
4521
|
// global reference to slice
|
|
4518
4522
|
const UNKNOWN_FUNCTION = '?';
|
|
4523
|
+
const OPERA10_PRIORITY = 10;
|
|
4524
|
+
const OPERA11_PRIORITY = 20;
|
|
4525
|
+
const CHROME_PRIORITY = 30;
|
|
4526
|
+
const WINJS_PRIORITY = 40;
|
|
4527
|
+
const GECKO_PRIORITY = 50;
|
|
4519
4528
|
function createFrame(filename, func, lineno, colno) {
|
|
4520
4529
|
const frame = {
|
|
4521
4530
|
filename,
|
|
@@ -4554,6 +4563,7 @@ var Sentry = (function (exports) {
|
|
|
4554
4563
|
}
|
|
4555
4564
|
return;
|
|
4556
4565
|
};
|
|
4566
|
+
const chromeStackParser = [CHROME_PRIORITY, chrome];
|
|
4557
4567
|
// gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
|
|
4558
4568
|
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
|
|
4559
4569
|
// We need this specific case for now because we want no other regex to match.
|
|
@@ -4567,7 +4577,7 @@ var Sentry = (function (exports) {
|
|
|
4567
4577
|
const subMatch = geckoEvalRegex.exec(parts[3]);
|
|
4568
4578
|
if (subMatch) {
|
|
4569
4579
|
// throw out eval line/column and use top-most line number
|
|
4570
|
-
parts[1] = parts[1] ||
|
|
4580
|
+
parts[1] = parts[1] || 'eval';
|
|
4571
4581
|
parts[3] = subMatch[1];
|
|
4572
4582
|
parts[4] = subMatch[2];
|
|
4573
4583
|
parts[5] = ''; // no column when eval
|
|
@@ -4580,6 +4590,7 @@ var Sentry = (function (exports) {
|
|
|
4580
4590
|
}
|
|
4581
4591
|
return;
|
|
4582
4592
|
};
|
|
4593
|
+
const geckoStackParser = [GECKO_PRIORITY, gecko];
|
|
4583
4594
|
const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
4584
4595
|
const winjs = line => {
|
|
4585
4596
|
const parts = winjsRegex.exec(line);
|
|
@@ -4587,16 +4598,19 @@ var Sentry = (function (exports) {
|
|
|
4587
4598
|
? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)
|
|
4588
4599
|
: undefined;
|
|
4589
4600
|
};
|
|
4601
|
+
const winjsStackParser = [WINJS_PRIORITY, winjs];
|
|
4590
4602
|
const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
4591
4603
|
const opera10 = line => {
|
|
4592
4604
|
const parts = opera10Regex.exec(line);
|
|
4593
4605
|
return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;
|
|
4594
4606
|
};
|
|
4607
|
+
const opera10StackParser = [OPERA10_PRIORITY, opera10];
|
|
4595
4608
|
const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
|
|
4596
4609
|
const opera11 = line => {
|
|
4597
4610
|
const parts = opera11Regex.exec(line);
|
|
4598
4611
|
return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
4599
4612
|
};
|
|
4613
|
+
const opera11StackParser = [OPERA11_PRIORITY, opera11];
|
|
4600
4614
|
/**
|
|
4601
4615
|
* Safari web extensions, starting version unknown, can produce "frames-only" stacktraces.
|
|
4602
4616
|
* What it means, is that instead of format like:
|
|
@@ -4640,7 +4654,7 @@ var Sentry = (function (exports) {
|
|
|
4640
4654
|
type: ex && ex.name,
|
|
4641
4655
|
value: extractMessage(ex),
|
|
4642
4656
|
};
|
|
4643
|
-
if (frames
|
|
4657
|
+
if (frames.length) {
|
|
4644
4658
|
exception.stacktrace = { frames };
|
|
4645
4659
|
}
|
|
4646
4660
|
if (exception.type === undefined && exception.value === '') {
|
|
@@ -4651,13 +4665,13 @@ var Sentry = (function (exports) {
|
|
|
4651
4665
|
/**
|
|
4652
4666
|
* @hidden
|
|
4653
4667
|
*/
|
|
4654
|
-
function eventFromPlainObject(exception, syntheticException,
|
|
4668
|
+
function eventFromPlainObject(exception, syntheticException, isUnhandledRejection) {
|
|
4655
4669
|
const event = {
|
|
4656
4670
|
exception: {
|
|
4657
4671
|
values: [
|
|
4658
4672
|
{
|
|
4659
|
-
type: isEvent(exception) ? exception.constructor.name :
|
|
4660
|
-
value: `Non-Error ${
|
|
4673
|
+
type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',
|
|
4674
|
+
value: `Non-Error ${isUnhandledRejection ? 'promise rejection' : 'exception'} captured with keys: ${extractExceptionKeysForMessage(exception)}`,
|
|
4661
4675
|
},
|
|
4662
4676
|
],
|
|
4663
4677
|
},
|
|
@@ -4691,8 +4705,7 @@ var Sentry = (function (exports) {
|
|
|
4691
4705
|
const stacktrace = ex.stacktrace || ex.stack || '';
|
|
4692
4706
|
const popSize = getPopSize(ex);
|
|
4693
4707
|
try {
|
|
4694
|
-
|
|
4695
|
-
return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);
|
|
4708
|
+
return createStackParser(opera10StackParser, opera11StackParser, chromeStackParser, winjsStackParser, geckoStackParser)(stacktrace, popSize);
|
|
4696
4709
|
}
|
|
4697
4710
|
catch (e) {
|
|
4698
4711
|
// no-empty
|
|
@@ -4717,7 +4730,6 @@ var Sentry = (function (exports) {
|
|
|
4717
4730
|
* https://github.com/getsentry/sentry-javascript/issues/1949
|
|
4718
4731
|
* In this specific case we try to extract stacktrace.message.error.message
|
|
4719
4732
|
*/
|
|
4720
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4721
4733
|
function extractMessage(ex) {
|
|
4722
4734
|
const message = ex && ex.message;
|
|
4723
4735
|
if (!message) {
|
|
@@ -4727,17 +4739,14 @@ var Sentry = (function (exports) {
|
|
|
4727
4739
|
return message.error.message;
|
|
4728
4740
|
}
|
|
4729
4741
|
return message;
|
|
4730
|
-
}
|
|
4731
|
-
|
|
4742
|
+
}
|
|
4732
4743
|
/**
|
|
4733
4744
|
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
4734
4745
|
* @hidden
|
|
4735
4746
|
*/
|
|
4736
|
-
function eventFromException(
|
|
4747
|
+
function eventFromException(exception, hint, attachStacktrace) {
|
|
4737
4748
|
const syntheticException = (hint && hint.syntheticException) || undefined;
|
|
4738
|
-
const event = eventFromUnknownInput(exception, syntheticException,
|
|
4739
|
-
attachStacktrace: options.attachStacktrace,
|
|
4740
|
-
});
|
|
4749
|
+
const event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);
|
|
4741
4750
|
addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
|
|
4742
4751
|
event.level = exports.Severity.Error;
|
|
4743
4752
|
if (hint && hint.event_id) {
|
|
@@ -4749,11 +4758,9 @@ var Sentry = (function (exports) {
|
|
|
4749
4758
|
* Builds and Event from a Message
|
|
4750
4759
|
* @hidden
|
|
4751
4760
|
*/
|
|
4752
|
-
function eventFromMessage(
|
|
4761
|
+
function eventFromMessage(message, level = exports.Severity.Info, hint, attachStacktrace) {
|
|
4753
4762
|
const syntheticException = (hint && hint.syntheticException) || undefined;
|
|
4754
|
-
const event = eventFromString(message, syntheticException,
|
|
4755
|
-
attachStacktrace: options.attachStacktrace,
|
|
4756
|
-
});
|
|
4763
|
+
const event = eventFromString(message, syntheticException, attachStacktrace);
|
|
4757
4764
|
event.level = level;
|
|
4758
4765
|
if (hint && hint.event_id) {
|
|
4759
4766
|
event.event_id = hint.event_id;
|
|
@@ -4763,7 +4770,7 @@ var Sentry = (function (exports) {
|
|
|
4763
4770
|
/**
|
|
4764
4771
|
* @hidden
|
|
4765
4772
|
*/
|
|
4766
|
-
function eventFromUnknownInput(exception, syntheticException,
|
|
4773
|
+
function eventFromUnknownInput(exception, syntheticException, attachStacktrace, isUnhandledRejection) {
|
|
4767
4774
|
let event;
|
|
4768
4775
|
if (isErrorEvent(exception) && exception.error) {
|
|
4769
4776
|
// If it is an ErrorEvent with `error` property, extract it to get actual Error
|
|
@@ -4785,7 +4792,7 @@ var Sentry = (function (exports) {
|
|
|
4785
4792
|
else {
|
|
4786
4793
|
const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
|
|
4787
4794
|
const message = domException.message ? `${name}: ${domException.message}` : name;
|
|
4788
|
-
event = eventFromString(message, syntheticException,
|
|
4795
|
+
event = eventFromString(message, syntheticException, attachStacktrace);
|
|
4789
4796
|
addExceptionTypeValue(event, message);
|
|
4790
4797
|
}
|
|
4791
4798
|
if ('code' in domException) {
|
|
@@ -4802,7 +4809,7 @@ var Sentry = (function (exports) {
|
|
|
4802
4809
|
// it manually. This will allow us to group events based on top-level keys which is much better than creating a new
|
|
4803
4810
|
// group on any key/value change.
|
|
4804
4811
|
const objectException = exception;
|
|
4805
|
-
event = eventFromPlainObject(objectException, syntheticException,
|
|
4812
|
+
event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);
|
|
4806
4813
|
addExceptionMechanism(event, {
|
|
4807
4814
|
synthetic: true,
|
|
4808
4815
|
});
|
|
@@ -4817,7 +4824,7 @@ var Sentry = (function (exports) {
|
|
|
4817
4824
|
// - a plain Object
|
|
4818
4825
|
//
|
|
4819
4826
|
// So bail out and capture it as a simple message:
|
|
4820
|
-
event = eventFromString(exception, syntheticException,
|
|
4827
|
+
event = eventFromString(exception, syntheticException, attachStacktrace);
|
|
4821
4828
|
addExceptionTypeValue(event, `${exception}`, undefined);
|
|
4822
4829
|
addExceptionMechanism(event, {
|
|
4823
4830
|
synthetic: true,
|
|
@@ -4827,11 +4834,11 @@ var Sentry = (function (exports) {
|
|
|
4827
4834
|
/**
|
|
4828
4835
|
* @hidden
|
|
4829
4836
|
*/
|
|
4830
|
-
function eventFromString(input, syntheticException,
|
|
4837
|
+
function eventFromString(input, syntheticException, attachStacktrace) {
|
|
4831
4838
|
const event = {
|
|
4832
4839
|
message: input,
|
|
4833
4840
|
};
|
|
4834
|
-
if (
|
|
4841
|
+
if (attachStacktrace && syntheticException) {
|
|
4835
4842
|
const frames = parseStackFrames(syntheticException);
|
|
4836
4843
|
if (frames.length) {
|
|
4837
4844
|
event.stacktrace = { frames };
|
|
@@ -4892,7 +4899,7 @@ var Sentry = (function (exports) {
|
|
|
4892
4899
|
const document = global$4.document;
|
|
4893
4900
|
let fetchImpl = global$4.fetch;
|
|
4894
4901
|
// eslint-disable-next-line deprecation/deprecation
|
|
4895
|
-
if (document && typeof document.createElement ===
|
|
4902
|
+
if (document && typeof document.createElement === 'function') {
|
|
4896
4903
|
try {
|
|
4897
4904
|
const sandbox = document.createElement('iframe');
|
|
4898
4905
|
sandbox.hidden = true;
|
|
@@ -5091,7 +5098,7 @@ var Sentry = (function (exports) {
|
|
|
5091
5098
|
return true;
|
|
5092
5099
|
}
|
|
5093
5100
|
else if (raHeader) {
|
|
5094
|
-
this._rateLimits.all = new Date(now + parseRetryAfterHeader(
|
|
5101
|
+
this._rateLimits.all = new Date(now + parseRetryAfterHeader(raHeader, now));
|
|
5095
5102
|
return true;
|
|
5096
5103
|
}
|
|
5097
5104
|
return false;
|
|
@@ -5229,13 +5236,13 @@ var Sentry = (function (exports) {
|
|
|
5229
5236
|
* @inheritDoc
|
|
5230
5237
|
*/
|
|
5231
5238
|
eventFromException(exception, hint) {
|
|
5232
|
-
return eventFromException(
|
|
5239
|
+
return eventFromException(exception, hint, this._options.attachStacktrace);
|
|
5233
5240
|
}
|
|
5234
5241
|
/**
|
|
5235
5242
|
* @inheritDoc
|
|
5236
5243
|
*/
|
|
5237
5244
|
eventFromMessage(message, level = exports.Severity.Info, hint) {
|
|
5238
|
-
return eventFromMessage(
|
|
5245
|
+
return eventFromMessage(message, level, hint, this._options.attachStacktrace);
|
|
5239
5246
|
}
|
|
5240
5247
|
/**
|
|
5241
5248
|
* @inheritDoc
|
|
@@ -5382,13 +5389,13 @@ var Sentry = (function (exports) {
|
|
|
5382
5389
|
}
|
|
5383
5390
|
if (!options.eventId) {
|
|
5384
5391
|
if (isDebugBuild()) {
|
|
5385
|
-
logger.error(
|
|
5392
|
+
logger.error('Missing eventId option in showReportDialog call');
|
|
5386
5393
|
}
|
|
5387
5394
|
return;
|
|
5388
5395
|
}
|
|
5389
5396
|
if (!options.dsn) {
|
|
5390
5397
|
if (isDebugBuild()) {
|
|
5391
|
-
logger.error(
|
|
5398
|
+
logger.error('Missing dsn option in showReportDialog call');
|
|
5392
5399
|
}
|
|
5393
5400
|
return;
|
|
5394
5401
|
}
|
|
@@ -5462,10 +5469,7 @@ var Sentry = (function (exports) {
|
|
|
5462
5469
|
}
|
|
5463
5470
|
const event = error === undefined && isString(msg)
|
|
5464
5471
|
? _eventFromIncompleteOnError(msg, url, line, column)
|
|
5465
|
-
: _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined,
|
|
5466
|
-
attachStacktrace,
|
|
5467
|
-
isRejection: false,
|
|
5468
|
-
}), url, line, column);
|
|
5472
|
+
: _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined, attachStacktrace, false), url, line, column);
|
|
5469
5473
|
event.level = exports.Severity.Error;
|
|
5470
5474
|
addMechanismAndCapture(hub, error, event, 'onerror');
|
|
5471
5475
|
});
|
|
@@ -5504,10 +5508,7 @@ var Sentry = (function (exports) {
|
|
|
5504
5508
|
}
|
|
5505
5509
|
const event = isPrimitive(error)
|
|
5506
5510
|
? _eventFromRejectionWithPrimitive(error)
|
|
5507
|
-
: eventFromUnknownInput(error, undefined,
|
|
5508
|
-
attachStacktrace,
|
|
5509
|
-
isRejection: true,
|
|
5510
|
-
});
|
|
5511
|
+
: eventFromUnknownInput(error, undefined, attachStacktrace, true);
|
|
5511
5512
|
event.level = exports.Severity.Error;
|
|
5512
5513
|
addMechanismAndCapture(hub, error, event, 'onunhandledrejection');
|
|
5513
5514
|
return;
|
|
@@ -6150,7 +6151,7 @@ var Sentry = (function (exports) {
|
|
|
6150
6151
|
// Juuust in case something goes wrong
|
|
6151
6152
|
try {
|
|
6152
6153
|
if (_shouldDropEvent(currentEvent, self._previousEvent)) {
|
|
6153
|
-
logger.warn(
|
|
6154
|
+
logger.warn('Event dropped due to being a duplicate of previously captured event.');
|
|
6154
6155
|
return null;
|
|
6155
6156
|
}
|
|
6156
6157
|
}
|