@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser",
|
|
3
|
-
"version": "6.18.
|
|
3
|
+
"version": "6.18.2",
|
|
4
4
|
"description": "Official Sentry SDK for browsers",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@sentry/core": "6.18.
|
|
20
|
-
"@sentry/types": "6.18.
|
|
21
|
-
"@sentry/utils": "6.18.
|
|
19
|
+
"@sentry/core": "6.18.2",
|
|
20
|
+
"@sentry/types": "6.18.2",
|
|
21
|
+
"@sentry/utils": "6.18.2",
|
|
22
22
|
"tslib": "^1.9.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"chai": "^4.1.2",
|
|
28
28
|
"chokidar": "^3.0.2",
|
|
29
29
|
"jsdom": "^15.0.0",
|
|
30
|
-
"karma": "^
|
|
30
|
+
"karma": "^6.3.16",
|
|
31
31
|
"karma-chai": "^0.1.0",
|
|
32
32
|
"karma-chrome-launcher": "^2.2.0",
|
|
33
33
|
"karma-firefox-launcher": "^2.1.2",
|
package/dist/parsers.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Event, Exception, StackFrame } from '@sentry/types';
|
|
2
|
-
/**
|
|
3
|
-
* This function creates an exception from an TraceKitStackTrace
|
|
4
|
-
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
export declare function exceptionFromError(ex: Error): Exception;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export declare function eventFromPlainObject(exception: Record<string, unknown>, syntheticException?: Error, rejection?: boolean): Event;
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export declare function eventFromError(ex: Error): Event;
|
|
16
|
-
/** Parses stack frames from an error */
|
|
17
|
-
export declare function parseStackFrames(ex: Error & {
|
|
18
|
-
framesToPop?: number;
|
|
19
|
-
stacktrace?: string;
|
|
20
|
-
}): StackFrame[];
|
|
21
|
-
//# sourceMappingURL=parsers.d.ts.map
|
package/dist/parsers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../src/parsers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK7D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,GAAG,SAAS,CAkBvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,kBAAkB,CAAC,EAAE,KAAK,EAC1B,SAAS,CAAC,EAAE,OAAO,GAClB,KAAK,CAyBP;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,CAM/C;AAED,wCAAwC;AACxC,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,KAAK,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,EAAE,CAgBxG"}
|
package/dist/parsers.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
var utils_1 = require("@sentry/utils");
|
|
3
|
-
var stack_parsers_1 = require("./stack-parsers");
|
|
4
|
-
/**
|
|
5
|
-
* This function creates an exception from an TraceKitStackTrace
|
|
6
|
-
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
function exceptionFromError(ex) {
|
|
10
|
-
// Get the frames first since Opera can lose the stack if we touch anything else first
|
|
11
|
-
var frames = parseStackFrames(ex);
|
|
12
|
-
var exception = {
|
|
13
|
-
type: ex && ex.name,
|
|
14
|
-
value: extractMessage(ex),
|
|
15
|
-
};
|
|
16
|
-
if (frames && frames.length) {
|
|
17
|
-
exception.stacktrace = { frames: frames };
|
|
18
|
-
}
|
|
19
|
-
if (exception.type === undefined && exception.value === '') {
|
|
20
|
-
exception.value = 'Unrecoverable error caught';
|
|
21
|
-
}
|
|
22
|
-
return exception;
|
|
23
|
-
}
|
|
24
|
-
exports.exceptionFromError = exceptionFromError;
|
|
25
|
-
/**
|
|
26
|
-
* @hidden
|
|
27
|
-
*/
|
|
28
|
-
function eventFromPlainObject(exception, syntheticException, rejection) {
|
|
29
|
-
var event = {
|
|
30
|
-
exception: {
|
|
31
|
-
values: [
|
|
32
|
-
{
|
|
33
|
-
type: utils_1.isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',
|
|
34
|
-
value: "Non-Error " + (rejection ? 'promise rejection' : 'exception') + " captured with keys: " + utils_1.extractExceptionKeysForMessage(exception),
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
extra: {
|
|
39
|
-
__serialized__: utils_1.normalizeToSize(exception),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
if (syntheticException) {
|
|
43
|
-
var frames_1 = parseStackFrames(syntheticException);
|
|
44
|
-
if (frames_1.length) {
|
|
45
|
-
event.stacktrace = { frames: frames_1 };
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return event;
|
|
49
|
-
}
|
|
50
|
-
exports.eventFromPlainObject = eventFromPlainObject;
|
|
51
|
-
/**
|
|
52
|
-
* @hidden
|
|
53
|
-
*/
|
|
54
|
-
function eventFromError(ex) {
|
|
55
|
-
return {
|
|
56
|
-
exception: {
|
|
57
|
-
values: [exceptionFromError(ex)],
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
exports.eventFromError = eventFromError;
|
|
62
|
-
/** Parses stack frames from an error */
|
|
63
|
-
function parseStackFrames(ex) {
|
|
64
|
-
// Access and store the stacktrace property before doing ANYTHING
|
|
65
|
-
// else to it because Opera is not very good at providing it
|
|
66
|
-
// reliably in other circumstances.
|
|
67
|
-
var stacktrace = ex.stacktrace || ex.stack || '';
|
|
68
|
-
var popSize = getPopSize(ex);
|
|
69
|
-
try {
|
|
70
|
-
// The order of the parsers in important
|
|
71
|
-
return utils_1.createStackParser(stack_parsers_1.opera10, stack_parsers_1.opera11, stack_parsers_1.chrome, stack_parsers_1.winjs, stack_parsers_1.gecko)(stacktrace, popSize);
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
// no-empty
|
|
75
|
-
}
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
exports.parseStackFrames = parseStackFrames;
|
|
79
|
-
// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
|
|
80
|
-
var reactMinifiedRegexp = /Minified React error #\d+;/i;
|
|
81
|
-
function getPopSize(ex) {
|
|
82
|
-
if (ex) {
|
|
83
|
-
if (typeof ex.framesToPop === 'number') {
|
|
84
|
-
return ex.framesToPop;
|
|
85
|
-
}
|
|
86
|
-
if (reactMinifiedRegexp.test(ex.message)) {
|
|
87
|
-
return 1;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return 0;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* There are cases where stacktrace.message is an Event object
|
|
94
|
-
* https://github.com/getsentry/sentry-javascript/issues/1949
|
|
95
|
-
* In this specific case we try to extract stacktrace.message.error.message
|
|
96
|
-
*/
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
-
function extractMessage(ex) {
|
|
99
|
-
var message = ex && ex.message;
|
|
100
|
-
if (!message) {
|
|
101
|
-
return 'No error message';
|
|
102
|
-
}
|
|
103
|
-
if (message.error && typeof message.error.message === 'string') {
|
|
104
|
-
return message.error.message;
|
|
105
|
-
}
|
|
106
|
-
return message;
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=parsers.js.map
|
package/dist/parsers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../src/parsers.ts"],"names":[],"mappings":";AAEA,uCAA4G;AAE5G,iDAAyE;AAEzE;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,EAAS;IAC1C,sFAAsF;IACtF,IAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAEpC,IAAM,SAAS,GAAc;QAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI;QACnB,KAAK,EAAE,cAAc,CAAC,EAAE,CAAC;KAC1B,CAAC;IAEF,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;QAC3B,SAAS,CAAC,UAAU,GAAG,EAAE,MAAM,QAAA,EAAE,CAAC;KACnC;IAED,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,SAAS,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C;IAEnD,IAAM,OAAO,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAE/B,IAAI;QACF,wCAAwC;QACxC,OAAO,yBAAiB,CAAC,uBAAO,EAAE,uBAAO,EAAE,sBAAM,EAAE,qBAAK,EAAE,qBAAK,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;KACvF;IAAC,OAAO,CAAC,EAAE;QACV,WAAW;KACZ;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAhBD,4CAgBC;AAED,2KAA2K;AAC3K,IAAM,mBAAmB,GAAG,6BAA6B,CAAC;AAE1D,SAAS,UAAU,CAAC,EAAoC;IACtD,IAAI,EAAE,EAAE;QACN,IAAI,OAAO,EAAE,CAAC,WAAW,KAAK,QAAQ,EAAE;YACtC,OAAO,EAAE,CAAC,WAAW,CAAC;SACvB;QAED,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;YACxC,OAAO,CAAC,CAAC;SACV;KACF;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,8DAA8D;AAC9D,SAAS,cAAc,CAAC,EAAO;IAC7B,IAAM,OAAO,GAAG,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC;IACjC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,kBAAkB,CAAC;KAC3B;IACD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;QAC9D,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;KAC9B;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport { Event, Exception, StackFrame } from '@sentry/types';\nimport { createStackParser, extractExceptionKeysForMessage, isEvent, normalizeToSize } from '@sentry/utils';\n\nimport { chrome, gecko, opera10, opera11, winjs } from './stack-parsers';\n\n/**\n * This function creates an exception from an TraceKitStackTrace\n * @param stacktrace TraceKitStackTrace that will be converted to an exception\n * @hidden\n */\nexport function exceptionFromError(ex: Error): Exception {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(ex);\n\n const exception: Exception = {\n type: ex && ex.name,\n value: extractMessage(ex),\n };\n\n if (frames && frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\n/**\n * @hidden\n */\nexport function eventFromPlainObject(\n exception: Record<string, unknown>,\n syntheticException?: Error,\n rejection?: boolean,\n): Event {\n const event: Event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',\n value: `Non-Error ${\n rejection ? 'promise rejection' : 'exception'\n } captured with keys: ${extractExceptionKeysForMessage(exception)}`,\n },\n ],\n },\n extra: {\n __serialized__: normalizeToSize(exception),\n },\n };\n\n if (syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromError(ex: Error): Event {\n return {\n exception: {\n values: [exceptionFromError(ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nexport function parseStackFrames(ex: Error & { framesToPop?: number; stacktrace?: string }): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const popSize = getPopSize(ex);\n\n try {\n // The order of the parsers in important\n return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);\n } catch (e) {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\nfunction getPopSize(ex: Error & { framesToPop?: number }): number {\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n if (reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n }\n\n return 0;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction extractMessage(ex: any): string {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n"]}
|
package/esm/parsers.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Event, Exception, StackFrame } from '@sentry/types';
|
|
2
|
-
/**
|
|
3
|
-
* This function creates an exception from an TraceKitStackTrace
|
|
4
|
-
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
export declare function exceptionFromError(ex: Error): Exception;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export declare function eventFromPlainObject(exception: Record<string, unknown>, syntheticException?: Error, rejection?: boolean): Event;
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export declare function eventFromError(ex: Error): Event;
|
|
16
|
-
/** Parses stack frames from an error */
|
|
17
|
-
export declare function parseStackFrames(ex: Error & {
|
|
18
|
-
framesToPop?: number;
|
|
19
|
-
stacktrace?: string;
|
|
20
|
-
}): StackFrame[];
|
|
21
|
-
//# sourceMappingURL=parsers.d.ts.map
|
package/esm/parsers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../src/parsers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK7D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,GAAG,SAAS,CAkBvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,kBAAkB,CAAC,EAAE,KAAK,EAC1B,SAAS,CAAC,EAAE,OAAO,GAClB,KAAK,CAyBP;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,CAM/C;AAED,wCAAwC;AACxC,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,KAAK,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,EAAE,CAgBxG"}
|
package/esm/parsers.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { createStackParser, extractExceptionKeysForMessage, isEvent, normalizeToSize } from '@sentry/utils';
|
|
2
|
-
import { chrome, gecko, opera10, opera11, winjs } from './stack-parsers';
|
|
3
|
-
/**
|
|
4
|
-
* This function creates an exception from an TraceKitStackTrace
|
|
5
|
-
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export function exceptionFromError(ex) {
|
|
9
|
-
// Get the frames first since Opera can lose the stack if we touch anything else first
|
|
10
|
-
var frames = parseStackFrames(ex);
|
|
11
|
-
var exception = {
|
|
12
|
-
type: ex && ex.name,
|
|
13
|
-
value: extractMessage(ex),
|
|
14
|
-
};
|
|
15
|
-
if (frames && frames.length) {
|
|
16
|
-
exception.stacktrace = { frames: frames };
|
|
17
|
-
}
|
|
18
|
-
if (exception.type === undefined && exception.value === '') {
|
|
19
|
-
exception.value = 'Unrecoverable error caught';
|
|
20
|
-
}
|
|
21
|
-
return exception;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
export function eventFromPlainObject(exception, syntheticException, rejection) {
|
|
27
|
-
var event = {
|
|
28
|
-
exception: {
|
|
29
|
-
values: [
|
|
30
|
-
{
|
|
31
|
-
type: isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',
|
|
32
|
-
value: "Non-Error " + (rejection ? 'promise rejection' : 'exception') + " captured with keys: " + extractExceptionKeysForMessage(exception),
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
extra: {
|
|
37
|
-
__serialized__: normalizeToSize(exception),
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
if (syntheticException) {
|
|
41
|
-
var frames_1 = parseStackFrames(syntheticException);
|
|
42
|
-
if (frames_1.length) {
|
|
43
|
-
event.stacktrace = { frames: frames_1 };
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return event;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @hidden
|
|
50
|
-
*/
|
|
51
|
-
export function eventFromError(ex) {
|
|
52
|
-
return {
|
|
53
|
-
exception: {
|
|
54
|
-
values: [exceptionFromError(ex)],
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/** Parses stack frames from an error */
|
|
59
|
-
export function parseStackFrames(ex) {
|
|
60
|
-
// Access and store the stacktrace property before doing ANYTHING
|
|
61
|
-
// else to it because Opera is not very good at providing it
|
|
62
|
-
// reliably in other circumstances.
|
|
63
|
-
var stacktrace = ex.stacktrace || ex.stack || '';
|
|
64
|
-
var popSize = getPopSize(ex);
|
|
65
|
-
try {
|
|
66
|
-
// The order of the parsers in important
|
|
67
|
-
return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
// no-empty
|
|
71
|
-
}
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
|
|
75
|
-
var reactMinifiedRegexp = /Minified React error #\d+;/i;
|
|
76
|
-
function getPopSize(ex) {
|
|
77
|
-
if (ex) {
|
|
78
|
-
if (typeof ex.framesToPop === 'number') {
|
|
79
|
-
return ex.framesToPop;
|
|
80
|
-
}
|
|
81
|
-
if (reactMinifiedRegexp.test(ex.message)) {
|
|
82
|
-
return 1;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return 0;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* There are cases where stacktrace.message is an Event object
|
|
89
|
-
* https://github.com/getsentry/sentry-javascript/issues/1949
|
|
90
|
-
* In this specific case we try to extract stacktrace.message.error.message
|
|
91
|
-
*/
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
-
function extractMessage(ex) {
|
|
94
|
-
var message = ex && ex.message;
|
|
95
|
-
if (!message) {
|
|
96
|
-
return 'No error message';
|
|
97
|
-
}
|
|
98
|
-
if (message.error && typeof message.error.message === 'string') {
|
|
99
|
-
return message.error.message;
|
|
100
|
-
}
|
|
101
|
-
return message;
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=parsers.js.map
|
package/esm/parsers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../src/parsers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5G,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAS;IAC1C,sFAAsF;IACtF,IAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAEpC,IAA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AAO,CAAC;AACjB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport { Event, Exception, StackFrame } from '@sentry/types';\nimport { createStackParser, extractExceptionKeysForMessage, isEvent, normalizeToSize } from '@sentry/utils';\n\nimport { chrome, gecko, opera10, opera11, winjs } from './stack-parsers';\n\n/**\n * This function creates an exception from an TraceKitStackTrace\n * @param stacktrace TraceKitStackTrace that will be converted to an exception\n * @hidden\n */\nexport function exceptionFromError(ex: Error): Exception {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(ex);\n\n const exception: Exception = {\n type: ex && ex.name,\n value: extractMessage(ex),\n };\n\n if (frames && frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\n/**\n * @hidden\n */\nexport function eventFromPlainObject(\n exception: Record<string, unknown>,\n syntheticException?: Error,\n rejection?: boolean,\n): Event {\n const event: Event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',\n value: `Non-Error ${\n rejection ? 'promise rejection' : 'exception'\n } captured with keys: ${extractExceptionKeysForMessage(exception)}`,\n },\n ],\n },\n extra: {\n __serialized__: normalizeToSize(exception),\n },\n };\n\n if (syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromError(ex: Error): Event {\n return {\n exception: {\n values: [exceptionFromError(ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nexport function parseStackFrames(ex: Error & { framesToPop?: number; stacktrace?: string }): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const popSize = getPopSize(ex);\n\n try {\n // The order of the parsers in important\n return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);\n } catch (e) {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\nfunction getPopSize(ex: Error & { framesToPop?: number }): number {\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n if (reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n }\n\n return 0;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction extractMessage(ex: any): string {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n"]}
|