@microsoft/applicationinsights-common 3.3.12-nightly3.2602-20 → 3.4.0-beta
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 +21 -2
- package/browser/es5/applicationinsights-common.cjs.js +1089 -289
- package/browser/es5/applicationinsights-common.cjs.js.map +1 -1
- package/browser/es5/applicationinsights-common.cjs.min.js +2 -2
- package/browser/es5/applicationinsights-common.cjs.min.js.map +1 -1
- package/browser/es5/applicationinsights-common.gbl.js +1091 -291
- package/browser/es5/applicationinsights-common.gbl.js.map +1 -1
- package/browser/es5/applicationinsights-common.gbl.min.js +2 -2
- package/browser/es5/applicationinsights-common.gbl.min.js.map +1 -1
- package/browser/es5/applicationinsights-common.integrity.json +25 -25
- package/browser/es5/applicationinsights-common.js +1091 -291
- package/browser/es5/applicationinsights-common.js.map +1 -1
- package/browser/es5/applicationinsights-common.min.js +2 -2
- package/browser/es5/applicationinsights-common.min.js.map +1 -1
- package/dist/es5/applicationinsights-common.js +1089 -289
- package/dist/es5/applicationinsights-common.js.map +1 -1
- package/dist/es5/applicationinsights-common.min.js +2 -2
- package/dist/es5/applicationinsights-common.min.js.map +1 -1
- package/dist-es5/applicationinsights-common.js +42 -32
- package/dist-es5/applicationinsights-common.js.map +1 -1
- package/package.json +65 -66
- package/types/applicationinsights-common.d.ts +408 -2574
- package/types/applicationinsights-common.namespaced.d.ts +2385 -89
- package/dist-es5/ConnectionStringParser.js +0 -44
- package/dist-es5/ConnectionStringParser.js.map +0 -1
- package/dist-es5/Constants.js +0 -22
- package/dist-es5/Constants.js.map +0 -1
- package/dist-es5/DomHelperFuncs.js +0 -22
- package/dist-es5/DomHelperFuncs.js.map +0 -1
- package/dist-es5/Enums.js +0 -30
- package/dist-es5/Enums.js.map +0 -1
- package/dist-es5/HelperFuncs.js +0 -50
- package/dist-es5/HelperFuncs.js.map +0 -1
- package/dist-es5/Interfaces/ConnectionString.js +0 -6
- package/dist-es5/Interfaces/ConnectionString.js.map +0 -1
- package/dist-es5/Interfaces/Context/IApplication.js +0 -8
- package/dist-es5/Interfaces/Context/IApplication.js.map +0 -1
- package/dist-es5/Interfaces/Context/IDevice.js +0 -8
- package/dist-es5/Interfaces/Context/IDevice.js.map +0 -1
- package/dist-es5/Interfaces/Context/IInternal.js +0 -8
- package/dist-es5/Interfaces/Context/IInternal.js.map +0 -1
- package/dist-es5/Interfaces/Context/ILocation.js +0 -8
- package/dist-es5/Interfaces/Context/ILocation.js.map +0 -1
- package/dist-es5/Interfaces/Context/IOperatingSystem.js +0 -8
- package/dist-es5/Interfaces/Context/IOperatingSystem.js.map +0 -1
- package/dist-es5/Interfaces/Context/ISample.js +0 -8
- package/dist-es5/Interfaces/Context/ISample.js.map +0 -1
- package/dist-es5/Interfaces/Context/ISession.js +0 -8
- package/dist-es5/Interfaces/Context/ISession.js.map +0 -1
- package/dist-es5/Interfaces/Context/ISessionManager.js +0 -8
- package/dist-es5/Interfaces/Context/ISessionManager.js.map +0 -1
- package/dist-es5/Interfaces/Context/ITelemetryTrace.js +0 -8
- package/dist-es5/Interfaces/Context/ITelemetryTrace.js.map +0 -1
- package/dist-es5/Interfaces/Context/IUser.js +0 -8
- package/dist-es5/Interfaces/Context/IUser.js.map +0 -1
- package/dist-es5/Interfaces/Context/IWeb.js +0 -8
- package/dist-es5/Interfaces/Context/IWeb.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/AvailabilityData.js +0 -52
- package/dist-es5/Interfaces/Contracts/AvailabilityData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/ContextTagKeys.js +0 -89
- package/dist-es5/Interfaces/Contracts/ContextTagKeys.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/DataPointType.js +0 -8
- package/dist-es5/Interfaces/Contracts/DataPointType.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/DependencyKind.js +0 -8
- package/dist-es5/Interfaces/Contracts/DependencyKind.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/DependencySourceType.js +0 -8
- package/dist-es5/Interfaces/Contracts/DependencySourceType.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IBase.js +0 -8
- package/dist-es5/Interfaces/Contracts/IBase.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IDataPoint.js +0 -6
- package/dist-es5/Interfaces/Contracts/IDataPoint.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IDomain.js +0 -8
- package/dist-es5/Interfaces/Contracts/IDomain.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IEnvelope.js +0 -46
- package/dist-es5/Interfaces/Contracts/IEnvelope.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IEventData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IEventData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IExceptionData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IExceptionData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IExceptionDetails.js +0 -8
- package/dist-es5/Interfaces/Contracts/IExceptionDetails.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IMessageData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IMessageData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IMetricData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IMetricData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IPageViewData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IPageViewData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IPageViewPerfData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IPageViewPerfData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IRemoteDependencyData.js +0 -8
- package/dist-es5/Interfaces/Contracts/IRemoteDependencyData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/IStackFrame.js +0 -8
- package/dist-es5/Interfaces/Contracts/IStackFrame.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/RequestData.js +0 -46
- package/dist-es5/Interfaces/Contracts/RequestData.js.map +0 -1
- package/dist-es5/Interfaces/Contracts/SeverityLevel.js +0 -18
- package/dist-es5/Interfaces/Contracts/SeverityLevel.js.map +0 -1
- package/dist-es5/Interfaces/IAppInsights.js +0 -8
- package/dist-es5/Interfaces/IAppInsights.js.map +0 -1
- package/dist-es5/Interfaces/IConfig.js +0 -26
- package/dist-es5/Interfaces/IConfig.js.map +0 -1
- package/dist-es5/Interfaces/ICorrelationConfig.js +0 -8
- package/dist-es5/Interfaces/ICorrelationConfig.js.map +0 -1
- package/dist-es5/Interfaces/IDependencyTelemetry.js +0 -8
- package/dist-es5/Interfaces/IDependencyTelemetry.js.map +0 -1
- package/dist-es5/Interfaces/IEventTelemetry.js +0 -6
- package/dist-es5/Interfaces/IEventTelemetry.js.map +0 -1
- package/dist-es5/Interfaces/IExceptionTelemetry.js +0 -8
- package/dist-es5/Interfaces/IExceptionTelemetry.js.map +0 -1
- package/dist-es5/Interfaces/IMetricTelemetry.js +0 -6
- package/dist-es5/Interfaces/IMetricTelemetry.js.map +0 -1
- package/dist-es5/Interfaces/IPageViewPerformanceTelemetry.js +0 -6
- package/dist-es5/Interfaces/IPageViewPerformanceTelemetry.js.map +0 -1
- package/dist-es5/Interfaces/IPageViewTelemetry.js +0 -6
- package/dist-es5/Interfaces/IPageViewTelemetry.js.map +0 -1
- package/dist-es5/Interfaces/IPartC.js +0 -8
- package/dist-es5/Interfaces/IPartC.js.map +0 -1
- package/dist-es5/Interfaces/IPropertiesPlugin.js +0 -8
- package/dist-es5/Interfaces/IPropertiesPlugin.js.map +0 -1
- package/dist-es5/Interfaces/IRequestContext.js +0 -6
- package/dist-es5/Interfaces/IRequestContext.js.map +0 -1
- package/dist-es5/Interfaces/IStorageBuffer.js +0 -6
- package/dist-es5/Interfaces/IStorageBuffer.js.map +0 -1
- package/dist-es5/Interfaces/ITelemetryContext.js +0 -8
- package/dist-es5/Interfaces/ITelemetryContext.js.map +0 -1
- package/dist-es5/Interfaces/IThrottleMgr.js +0 -6
- package/dist-es5/Interfaces/IThrottleMgr.js.map +0 -1
- package/dist-es5/Interfaces/ITraceTelemetry.js +0 -8
- package/dist-es5/Interfaces/ITraceTelemetry.js.map +0 -1
- package/dist-es5/Interfaces/PartAExtensions.js +0 -17
- package/dist-es5/Interfaces/PartAExtensions.js.map +0 -1
- package/dist-es5/Interfaces/Telemetry/IEnvelope.js +0 -8
- package/dist-es5/Interfaces/Telemetry/IEnvelope.js.map +0 -1
- package/dist-es5/Interfaces/Telemetry/ISerializable.js +0 -8
- package/dist-es5/Interfaces/Telemetry/ISerializable.js.map +0 -1
- package/dist-es5/Offline.js +0 -137
- package/dist-es5/Offline.js.map +0 -1
- package/dist-es5/RequestResponseHeaders.js +0 -19
- package/dist-es5/RequestResponseHeaders.js.map +0 -1
- package/dist-es5/StorageHelperFuncs.js +0 -184
- package/dist-es5/StorageHelperFuncs.js.map +0 -1
- package/dist-es5/Telemetry/Common/Data.js +0 -25
- package/dist-es5/Telemetry/Common/Data.js.map +0 -1
- package/dist-es5/Telemetry/Common/DataPoint.js +0 -29
- package/dist-es5/Telemetry/Common/DataPoint.js.map +0 -1
- package/dist-es5/Telemetry/Common/DataSanitizer.js +0 -129
- package/dist-es5/Telemetry/Common/DataSanitizer.js.map +0 -1
- package/dist-es5/Telemetry/Common/Envelope.js +0 -38
- package/dist-es5/Telemetry/Common/Envelope.js.map +0 -1
- package/dist-es5/Telemetry/Event.js +0 -32
- package/dist-es5/Telemetry/Event.js.map +0 -1
- package/dist-es5/Telemetry/Exception.js +0 -759
- package/dist-es5/Telemetry/Exception.js.map +0 -1
- package/dist-es5/Telemetry/Metric.js +0 -39
- package/dist-es5/Telemetry/Metric.js.map +0 -1
- package/dist-es5/Telemetry/PageView.js +0 -41
- package/dist-es5/Telemetry/PageView.js.map +0 -1
- package/dist-es5/Telemetry/PageViewPerformance.js +0 -48
- package/dist-es5/Telemetry/PageViewPerformance.js.map +0 -1
- package/dist-es5/Telemetry/RemoteDependencyData.js +0 -62
- package/dist-es5/Telemetry/RemoteDependencyData.js.map +0 -1
- package/dist-es5/Telemetry/Trace.js +0 -36
- package/dist-es5/Telemetry/Trace.js.map +0 -1
- package/dist-es5/TelemetryItemCreator.js +0 -65
- package/dist-es5/TelemetryItemCreator.js.map +0 -1
- package/dist-es5/ThrottleMgr.js +0 -388
- package/dist-es5/ThrottleMgr.js.map +0 -1
- package/dist-es5/UrlHelperFuncs.js +0 -90
- package/dist-es5/UrlHelperFuncs.js.map +0 -1
- package/dist-es5/Util.js +0 -198
- package/dist-es5/Util.js.map +0 -1
- package/dist-es5/__DynamicConstants.js +0 -44
- package/dist-es5/__DynamicConstants.js.map +0 -1
|
@@ -1,759 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Common, 3.3.12-nightly3.2602-20
|
|
3
|
-
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { __assignFn as __assign } from "@microsoft/applicationinsights-shims";
|
|
8
|
-
import { arrForEach, arrMap, isArray, isError, isFunction, isNullOrUndefined, isObject, isString, strTrim } from "@microsoft/applicationinsights-core-js";
|
|
9
|
-
import { asString, getWindow, objFreeze, strIndexOf } from "@nevware21/ts-utils";
|
|
10
|
-
import { strNotSpecified } from "../Constants";
|
|
11
|
-
import { _DYN_AI_DATA_CONTRACT, _DYN_ASSEMBLY, _DYN_EXCEPTIONS, _DYN_FILE_NAME, _DYN_HAS_FULL_STACK, _DYN_LENGTH, _DYN_LINE, _DYN_MATCH, _DYN_MEASUREMENTS, _DYN_MESSAGE, _DYN_NAME, _DYN_PARSED_STACK, _DYN_PROBLEM_GROUP, _DYN_PROPERTIES, _DYN_SEVERITY_LEVEL, _DYN_SIZE_IN_BYTES, _DYN_SPLIT, _DYN_STRINGIFY, _DYN_TO_STRING, _DYN_TYPE_NAME } from "../__DynamicConstants";
|
|
12
|
-
import { dataSanitizeException, dataSanitizeMeasurements, dataSanitizeMessage, dataSanitizeProperties, dataSanitizeString } from "./Common/DataSanitizer";
|
|
13
|
-
// These Regex covers the following patterns
|
|
14
|
-
// 1. Chrome/Firefox/IE/Edge:
|
|
15
|
-
// at functionName (filename:lineNumber:columnNumber)
|
|
16
|
-
// at functionName (filename:lineNumber)
|
|
17
|
-
// at filename:lineNumber:columnNumber
|
|
18
|
-
// at filename:lineNumber
|
|
19
|
-
// at functionName@filename:lineNumber:columnNumber
|
|
20
|
-
// 2. Safari / Opera:
|
|
21
|
-
// functionName@filename:lineNumber:columnNumber
|
|
22
|
-
// functionName@filename:lineNumber
|
|
23
|
-
// filename:lineNumber:columnNumber
|
|
24
|
-
// filename:lineNumber
|
|
25
|
-
// Line ## of scriptname script filename:lineNumber:columnNumber
|
|
26
|
-
// Line ## of scriptname script filename
|
|
27
|
-
// 3. IE/Edge (Additional formats)
|
|
28
|
-
// at functionName@filename:lineNumber
|
|
29
|
-
var STACKFRAME_BASE_SIZE = 58; // '{"method":"","level":,"assembly":"","fileName":"","line":}'.length
|
|
30
|
-
/**
|
|
31
|
-
* Check if the string conforms to what looks like a stack frame line and not just a general message
|
|
32
|
-
* comment or other non-stack related info.
|
|
33
|
-
*
|
|
34
|
-
* This should be used to filter out any leading "message" lines from a stack trace, before attempting to parse
|
|
35
|
-
* the individual stack frames. Once you have estabilsted the start of the stack frames you can then use the
|
|
36
|
-
* FULL_STACK_FRAME_1, FULL_STACK_FRAME_2, FULL_STACK_FRAME_3, and EXTRACT_FILENAME to parse the individual
|
|
37
|
-
* stack frames to extract the method, filename, line number, and column number.
|
|
38
|
-
* These may still provide invalid matches, so the sequence of execution is important to avoid providing
|
|
39
|
-
* an invalid parsed stack.
|
|
40
|
-
*/
|
|
41
|
-
var IS_FRAME = /^\s{0,50}(from\s|at\s|Line\s{1,5}\d{1,10}\s{1,5}of|\w{1,50}@\w{1,80}|[^\(\s\n]+:[0-9\?]+(?::[0-9\?]+)?)/;
|
|
42
|
-
/**
|
|
43
|
-
* Parse a well formed stack frame with both the line and column numbers
|
|
44
|
-
* ----------------------------------
|
|
45
|
-
* **Primary focus of the matching**
|
|
46
|
-
* - at functionName (filename:lineNumber:columnNumber)
|
|
47
|
-
* - at filename:lineNumber:columnNumber
|
|
48
|
-
* - at functionName@filename:lineNumber:columnNumber
|
|
49
|
-
* - functionName (filename:lineNumber:columnNumber)
|
|
50
|
-
* - filename:lineNumber:columnNumber
|
|
51
|
-
* - functionName@filename:lineNumber:columnNumber
|
|
52
|
-
*/
|
|
53
|
-
var FULL_STACK_FRAME_1 = /^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\]]+):([0-9\?]+):([0-9\?]+)\)?$/;
|
|
54
|
-
/**
|
|
55
|
-
* Parse a well formed stack frame with only a line number.
|
|
56
|
-
* ----------------------------------
|
|
57
|
-
* > Note: this WILL also match with line and column number, but the line number is included with the filename
|
|
58
|
-
* > you should attempt to match with FULL_STACK_FRAME_1 first.
|
|
59
|
-
*
|
|
60
|
-
* **Primary focus of the matching (run FULL_STACK_FRAME_1 first)**
|
|
61
|
-
* - at functionName (filename:lineNumber)
|
|
62
|
-
* - at filename:lineNumber
|
|
63
|
-
* - at functionName@filename:lineNumber
|
|
64
|
-
* - functionName (filename:lineNumber)
|
|
65
|
-
* - filename:lineNumber
|
|
66
|
-
* - functionName@filename:lineNumber
|
|
67
|
-
*
|
|
68
|
-
* **Secondary matches**
|
|
69
|
-
* - at functionName (filename:lineNumber:columnNumber)
|
|
70
|
-
* - at filename:lineNumber:columnNumber
|
|
71
|
-
* - at functionName@filename:lineNumber:columnNumber
|
|
72
|
-
* - functionName (filename:lineNumber:columnNumber)
|
|
73
|
-
* - filename:lineNumber:columnNumber
|
|
74
|
-
* - functionName@filename:lineNumber:columnNumber
|
|
75
|
-
*/
|
|
76
|
-
var FULL_STACK_FRAME_2 = /^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\]]+):([0-9\?]+)\)?$/;
|
|
77
|
-
/**
|
|
78
|
-
* Attempt to Parse a frame that doesn't include a line or column number.
|
|
79
|
-
* ----------------------------------
|
|
80
|
-
* > Note: this WILL also match lines with a line or line and column number, you should attempt to match with
|
|
81
|
-
* both FULL_STACK_FRAME_1 and FULL_STACK_FRAME_2 first to avoid false positives.
|
|
82
|
-
*
|
|
83
|
-
* **Unexpected Invalid Matches** (Matches that should be avoided -- by using the FULL_STACK_FRAME_1 and FULL_STACK_FRAME_2 first)
|
|
84
|
-
* - at https://localhost:44365/static/node_bundles/@microsoft/blah/js/bundle.js:144112:27
|
|
85
|
-
* - at https://localhost:44365/static/node_bundles/@microsoft/blah/js/bundle.js:144112:27
|
|
86
|
-
*
|
|
87
|
-
* **Primary focus of the matching (run FULL_STACK_FRAME_1 first)**
|
|
88
|
-
* - at functionName@filename
|
|
89
|
-
* - at functionName (filename)
|
|
90
|
-
* - at functionName filename
|
|
91
|
-
* - at filename <- Will actuall match this as the "method" and not the filename (care should be taken to avoid this)
|
|
92
|
-
* - functionName@filename
|
|
93
|
-
* - functionName (filename)
|
|
94
|
-
* - functionName filename
|
|
95
|
-
* - functionName
|
|
96
|
-
*
|
|
97
|
-
* **Secondary matches** (The line and column numbers will be included with the matched filename)
|
|
98
|
-
* - at functionName (filename:lineNumber:columnNumber)
|
|
99
|
-
* - at functionName (filename:lineNumber)
|
|
100
|
-
* - at filename:lineNumber:columnNumber
|
|
101
|
-
* - at filename:lineNumber
|
|
102
|
-
* - at functionName@filename:lineNumber:columnNumber
|
|
103
|
-
* - at functionName@filename:lineNumber
|
|
104
|
-
* - functionName (filename:lineNumber:columnNumber)
|
|
105
|
-
* - functionName (filename:lineNumber)
|
|
106
|
-
* - filename:lineNumber:columnNumber
|
|
107
|
-
* - filename:lineNumber
|
|
108
|
-
* - functionName@filename:lineNumber:columnNumber
|
|
109
|
-
* - functionName@filename:lineNumber
|
|
110
|
-
*/
|
|
111
|
-
var FULL_STACK_FRAME_3 = /^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\)\]]+)\)?$/;
|
|
112
|
-
/**
|
|
113
|
-
* Attempt to extract the filename (with or without line and column numbers) from a string.
|
|
114
|
-
* ----------------------------------
|
|
115
|
-
* > Note: this will only match the filename (with any line or column numbers) and will
|
|
116
|
-
* > return what looks like the filename, however, it will also match random strings that
|
|
117
|
-
* > look like a filename, so care should be taken to ensure that the filename is actually
|
|
118
|
-
* > a filename before using it.
|
|
119
|
-
* >
|
|
120
|
-
* > It is recommended to use this in conjunction with the FULL_STACK_FRAME_1, FULL_STACK_FRAME_2, and FULL_STACK_FRAME_3
|
|
121
|
-
* > to ensure first to reduce false matches, if all of these fail then you can use this to extract the filename from a random
|
|
122
|
-
* > strings to identify any potential filename from a known stack frame line.
|
|
123
|
-
*
|
|
124
|
-
* **Known Invalid matching**
|
|
125
|
-
*
|
|
126
|
-
* This regex will basically match any "final" string of a line or one that is trailed by a comma, so this should not
|
|
127
|
-
* be used as the "only" matching regex, but rather as a final fallback to extract the filename from a string.
|
|
128
|
-
* If you are certain that the string line is a stack frame and not part of the exception message (lines before the stack)
|
|
129
|
-
* or trailing comments, then you can use this to extract the filename and then further parse with PARSE_FILENAME_LINE_COL
|
|
130
|
-
* and PARSE_FILENAME_LINE_ONLY to extract any potential the line and column numbers.
|
|
131
|
-
*
|
|
132
|
-
* **Primary focus of the matching**
|
|
133
|
-
* - at (anonymous) @ VM60:1
|
|
134
|
-
* - Line 21 of linked script file://localhost/C:/Temp/stacktrace.js
|
|
135
|
-
* - Line 11 of inline#1 script in http://localhost:3000/static/js/main.206f4846.js:2:296748
|
|
136
|
-
* - Line 68 of inline#2 script in file://localhost/teststack.html
|
|
137
|
-
* - at Global code (http://example.com/stacktrace.js:11:1)
|
|
138
|
-
*/
|
|
139
|
-
var EXTRACT_FILENAME = /(?:^|\(|\s{0,10}[\w\)]+\@)?([^\(\n\s\]\)]+)(?:\:([0-9]+)(?:\:([0-9]+))?)?\)?(?:,|$)/;
|
|
140
|
-
/**
|
|
141
|
-
* Attempt to extract the filename, line number, and column number from a string.
|
|
142
|
-
*/
|
|
143
|
-
var PARSE_FILENAME_LINE_COL = /([^\(\s\n]+):([0-9]+):([0-9]+)$/;
|
|
144
|
-
/**
|
|
145
|
-
* Attempt to extract the filename and line number from a string.
|
|
146
|
-
*/
|
|
147
|
-
var PARSE_FILENAME_LINE_ONLY = /([^\(\s\n]+):([0-9]+)$/;
|
|
148
|
-
var NoMethod = "<no_method>";
|
|
149
|
-
var strError = "error";
|
|
150
|
-
var strStack = "stack";
|
|
151
|
-
var strStackDetails = "stackDetails";
|
|
152
|
-
var strErrorSrc = "errorSrc";
|
|
153
|
-
var strMessage = "message";
|
|
154
|
-
var strDescription = "description";
|
|
155
|
-
var _parseSequence = [
|
|
156
|
-
{ re: FULL_STACK_FRAME_1, len: 5, m: 1, fn: 2, ln: 3, col: 4 },
|
|
157
|
-
{ chk: _ignoreNative, pre: _scrubAnonymous, re: FULL_STACK_FRAME_2, len: 4, m: 1, fn: 2, ln: 3 },
|
|
158
|
-
{ re: FULL_STACK_FRAME_3, len: 3, m: 1, fn: 2, hdl: _handleFilename },
|
|
159
|
-
{ re: EXTRACT_FILENAME, len: 2, fn: 1, hdl: _handleFilename }
|
|
160
|
-
];
|
|
161
|
-
function _scrubAnonymous(frame) {
|
|
162
|
-
return frame.replace(/(\(anonymous\))/, "<anonymous>");
|
|
163
|
-
}
|
|
164
|
-
function _ignoreNative(frame) {
|
|
165
|
-
return strIndexOf(frame, "[native") < 0;
|
|
166
|
-
}
|
|
167
|
-
function _stringify(value, convertToString) {
|
|
168
|
-
var result = value;
|
|
169
|
-
if (result && !isString(result)) {
|
|
170
|
-
if (JSON && JSON[_DYN_STRINGIFY /* @min:%2estringify */]) {
|
|
171
|
-
result = JSON[_DYN_STRINGIFY /* @min:%2estringify */](value);
|
|
172
|
-
if (convertToString && (!result || result === "{}")) {
|
|
173
|
-
if (isFunction(value[_DYN_TO_STRING /* @min:%2etoString */])) {
|
|
174
|
-
result = value[_DYN_TO_STRING /* @min:%2etoString */]();
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
result = "" + value;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
result = "" + value + " - (Missing JSON.stringify)";
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return result || "";
|
|
186
|
-
}
|
|
187
|
-
function _formatMessage(theEvent, errorType) {
|
|
188
|
-
var evtMessage = theEvent;
|
|
189
|
-
if (theEvent) {
|
|
190
|
-
if (evtMessage && !isString(evtMessage)) {
|
|
191
|
-
evtMessage = theEvent[strMessage] || theEvent[strDescription] || evtMessage;
|
|
192
|
-
}
|
|
193
|
-
// Make sure the message is a string
|
|
194
|
-
if (evtMessage && !isString(evtMessage)) {
|
|
195
|
-
// tslint:disable-next-line: prefer-conditional-expression
|
|
196
|
-
evtMessage = _stringify(evtMessage, true);
|
|
197
|
-
}
|
|
198
|
-
if (theEvent["filename"]) {
|
|
199
|
-
// Looks like an event object with filename
|
|
200
|
-
evtMessage = evtMessage + " @" + (theEvent["filename"] || "") + ":" + (theEvent["lineno"] || "?") + ":" + (theEvent["colno"] || "?");
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// Automatically add the error type to the message if it does already appear to be present
|
|
204
|
-
if (errorType && errorType !== "String" && errorType !== "Object" && errorType !== "Error" && strIndexOf(evtMessage || "", errorType) === -1) {
|
|
205
|
-
evtMessage = errorType + ": " + evtMessage;
|
|
206
|
-
}
|
|
207
|
-
return evtMessage || "";
|
|
208
|
-
}
|
|
209
|
-
function _isExceptionDetailsInternal(value) {
|
|
210
|
-
try {
|
|
211
|
-
if (isObject(value)) {
|
|
212
|
-
return "hasFullStack" in value && "typeName" in value;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
catch (e) {
|
|
216
|
-
// This can happen with some native browser objects, but should not happen for the type we are checking for
|
|
217
|
-
}
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
function _isExceptionInternal(value) {
|
|
221
|
-
try {
|
|
222
|
-
if (isObject(value)) {
|
|
223
|
-
return ("ver" in value && "exceptions" in value && "properties" in value);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
catch (e) {
|
|
227
|
-
// This can happen with some native browser objects, but should not happen for the type we are checking for
|
|
228
|
-
}
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
function _isStackDetails(details) {
|
|
232
|
-
return details && details.src && isString(details.src) && details.obj && isArray(details.obj);
|
|
233
|
-
}
|
|
234
|
-
function _convertStackObj(errorStack) {
|
|
235
|
-
var src = errorStack || "";
|
|
236
|
-
if (!isString(src)) {
|
|
237
|
-
if (isString(src[strStack])) {
|
|
238
|
-
src = src[strStack];
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
src = "" + src;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
var items = src[_DYN_SPLIT /* @min:%2esplit */]("\n");
|
|
245
|
-
return {
|
|
246
|
-
src: src,
|
|
247
|
-
obj: items
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function _getOperaStack(errorMessage) {
|
|
251
|
-
var stack = [];
|
|
252
|
-
var lines = errorMessage[_DYN_SPLIT /* @min:%2esplit */]("\n");
|
|
253
|
-
for (var lp = 0; lp < lines[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
254
|
-
var entry = lines[lp];
|
|
255
|
-
if (lines[lp + 1]) {
|
|
256
|
-
entry += "@" + lines[lp + 1];
|
|
257
|
-
lp++;
|
|
258
|
-
}
|
|
259
|
-
stack.push(entry);
|
|
260
|
-
}
|
|
261
|
-
return {
|
|
262
|
-
src: errorMessage,
|
|
263
|
-
obj: stack
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function _getStackFromErrorObj(errorObj) {
|
|
267
|
-
var details = null;
|
|
268
|
-
if (errorObj) {
|
|
269
|
-
try {
|
|
270
|
-
/* Using bracket notation is support older browsers (IE 7/8 -- dont remember the version) that throw when using dot
|
|
271
|
-
notation for undefined objects and we don't want to loose the error from being reported */
|
|
272
|
-
if (errorObj[strStack]) {
|
|
273
|
-
// Chrome/Firefox
|
|
274
|
-
details = _convertStackObj(errorObj[strStack]);
|
|
275
|
-
}
|
|
276
|
-
else if (errorObj[strError] && errorObj[strError][strStack]) {
|
|
277
|
-
// Edge error event provides the stack and error object
|
|
278
|
-
details = _convertStackObj(errorObj[strError][strStack]);
|
|
279
|
-
}
|
|
280
|
-
else if (errorObj["exception"] && errorObj.exception[strStack]) {
|
|
281
|
-
details = _convertStackObj(errorObj.exception[strStack]);
|
|
282
|
-
}
|
|
283
|
-
else if (_isStackDetails(errorObj)) {
|
|
284
|
-
details = errorObj;
|
|
285
|
-
}
|
|
286
|
-
else if (_isStackDetails(errorObj[strStackDetails])) {
|
|
287
|
-
details = errorObj[strStackDetails];
|
|
288
|
-
}
|
|
289
|
-
else if (getWindow() && getWindow()["opera"] && errorObj[strMessage]) {
|
|
290
|
-
// Opera
|
|
291
|
-
details = _getOperaStack(errorObj[_DYN_MESSAGE /* @min:%2emessage */]);
|
|
292
|
-
}
|
|
293
|
-
else if (errorObj["reason"] && errorObj.reason[strStack]) {
|
|
294
|
-
// UnhandledPromiseRejection
|
|
295
|
-
details = _convertStackObj(errorObj.reason[strStack]);
|
|
296
|
-
}
|
|
297
|
-
else if (isString(errorObj)) {
|
|
298
|
-
details = _convertStackObj(errorObj);
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
var evtMessage = errorObj[strMessage] || errorObj[strDescription] || "";
|
|
302
|
-
if (isString(errorObj[strErrorSrc])) {
|
|
303
|
-
if (evtMessage) {
|
|
304
|
-
evtMessage += "\n";
|
|
305
|
-
}
|
|
306
|
-
evtMessage += " from " + errorObj[strErrorSrc];
|
|
307
|
-
}
|
|
308
|
-
if (evtMessage) {
|
|
309
|
-
details = _convertStackObj(evtMessage);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
catch (e) {
|
|
314
|
-
// something unexpected happened so to avoid failing to report any error lets swallow the exception
|
|
315
|
-
// and fallback to the callee/caller method
|
|
316
|
-
details = _convertStackObj(e);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return details || {
|
|
320
|
-
src: "",
|
|
321
|
-
obj: null
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function _formatStackTrace(stackDetails) {
|
|
325
|
-
var stack = "";
|
|
326
|
-
if (stackDetails) {
|
|
327
|
-
if (stackDetails.obj) {
|
|
328
|
-
stack = stackDetails.obj.join("\n");
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
stack = stackDetails.src || "";
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return stack;
|
|
335
|
-
}
|
|
336
|
-
function _parseStack(stack) {
|
|
337
|
-
var parsedStack;
|
|
338
|
-
var frames = stack.obj;
|
|
339
|
-
if (frames && frames[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
340
|
-
parsedStack = [];
|
|
341
|
-
var level_1 = 0;
|
|
342
|
-
var foundStackStart_1 = false;
|
|
343
|
-
var totalSizeInBytes_1 = 0;
|
|
344
|
-
arrForEach(frames, function (frame) {
|
|
345
|
-
if (foundStackStart_1 || _isStackFrame(frame)) {
|
|
346
|
-
var theFrame = asString(frame);
|
|
347
|
-
// Once we have found the first stack frame we treat the rest of the lines as part of the stack
|
|
348
|
-
foundStackStart_1 = true;
|
|
349
|
-
var parsedFrame = _extractStackFrame(theFrame, level_1);
|
|
350
|
-
if (parsedFrame) {
|
|
351
|
-
totalSizeInBytes_1 += parsedFrame[_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */];
|
|
352
|
-
parsedStack.push(parsedFrame);
|
|
353
|
-
level_1++;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
// DP Constraint - exception parsed stack must be < 32KB
|
|
358
|
-
// remove frames from the middle to meet the threshold
|
|
359
|
-
var exceptionParsedStackThreshold = 32 * 1024;
|
|
360
|
-
if (totalSizeInBytes_1 > exceptionParsedStackThreshold) {
|
|
361
|
-
var left = 0;
|
|
362
|
-
var right = parsedStack[_DYN_LENGTH /* @min:%2elength */] - 1;
|
|
363
|
-
var size = 0;
|
|
364
|
-
var acceptedLeft = left;
|
|
365
|
-
var acceptedRight = right;
|
|
366
|
-
while (left < right) {
|
|
367
|
-
// check size
|
|
368
|
-
var lSize = parsedStack[left][_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */];
|
|
369
|
-
var rSize = parsedStack[right][_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */];
|
|
370
|
-
size += lSize + rSize;
|
|
371
|
-
if (size > exceptionParsedStackThreshold) {
|
|
372
|
-
// remove extra frames from the middle
|
|
373
|
-
var howMany = acceptedRight - acceptedLeft + 1;
|
|
374
|
-
parsedStack.splice(acceptedLeft, howMany);
|
|
375
|
-
break;
|
|
376
|
-
}
|
|
377
|
-
// update pointers
|
|
378
|
-
acceptedLeft = left;
|
|
379
|
-
acceptedRight = right;
|
|
380
|
-
left++;
|
|
381
|
-
right--;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return parsedStack;
|
|
386
|
-
}
|
|
387
|
-
function _getErrorType(errorType) {
|
|
388
|
-
// Gets the Error Type by passing the constructor (used to get the true type of native error object).
|
|
389
|
-
var typeName = "";
|
|
390
|
-
if (errorType) {
|
|
391
|
-
typeName = errorType.typeName || errorType[_DYN_NAME /* @min:%2ename */] || "";
|
|
392
|
-
if (!typeName) {
|
|
393
|
-
try {
|
|
394
|
-
var funcNameRegex = /function (.{1,200})\(/;
|
|
395
|
-
var results = (funcNameRegex).exec((errorType).constructor[_DYN_TO_STRING /* @min:%2etoString */]());
|
|
396
|
-
typeName = (results && results[_DYN_LENGTH /* @min:%2elength */] > 1) ? results[1] : "";
|
|
397
|
-
}
|
|
398
|
-
catch (e) {
|
|
399
|
-
// eslint-disable-next-line no-empty -- Ignoring any failures as nothing we can do
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return typeName;
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Formats the provided errorObj for display and reporting, it may be a String, Object, integer or undefined depending on the browser.
|
|
407
|
-
* @param errorObj - The supplied errorObj
|
|
408
|
-
*/
|
|
409
|
-
export function _formatErrorCode(errorObj) {
|
|
410
|
-
if (errorObj) {
|
|
411
|
-
try {
|
|
412
|
-
if (!isString(errorObj)) {
|
|
413
|
-
var errorType = _getErrorType(errorObj);
|
|
414
|
-
var result = _stringify(errorObj, false);
|
|
415
|
-
if (!result || result === "{}") {
|
|
416
|
-
if (errorObj[strError]) {
|
|
417
|
-
// Looks like an MS Error Event
|
|
418
|
-
errorObj = errorObj[strError];
|
|
419
|
-
errorType = _getErrorType(errorObj);
|
|
420
|
-
}
|
|
421
|
-
result = _stringify(errorObj, true);
|
|
422
|
-
}
|
|
423
|
-
if (strIndexOf(result, errorType) !== 0 && errorType !== "String") {
|
|
424
|
-
return errorType + ":" + result;
|
|
425
|
-
}
|
|
426
|
-
return result;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
catch (e) {
|
|
430
|
-
// eslint-disable-next-line no-empty -- Ignoring any failures as nothing we can do
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
// Fallback to just letting the object format itself into a string
|
|
434
|
-
return "" + (errorObj || "");
|
|
435
|
-
}
|
|
436
|
-
var Exception = /** @class */ (function () {
|
|
437
|
-
/**
|
|
438
|
-
* Constructs a new instance of the ExceptionTelemetry object
|
|
439
|
-
*/
|
|
440
|
-
function Exception(logger, exception, properties, measurements, severityLevel, id) {
|
|
441
|
-
this.aiDataContract = {
|
|
442
|
-
ver: 1 /* FieldType.Required */,
|
|
443
|
-
exceptions: 1 /* FieldType.Required */,
|
|
444
|
-
severityLevel: 0 /* FieldType.Default */,
|
|
445
|
-
properties: 0 /* FieldType.Default */,
|
|
446
|
-
measurements: 0 /* FieldType.Default */
|
|
447
|
-
};
|
|
448
|
-
var _self = this;
|
|
449
|
-
_self.ver = 2; // TODO: handle the CS"4.0" ==> breeze 2 conversion in a better way
|
|
450
|
-
if (!_isExceptionInternal(exception)) {
|
|
451
|
-
if (!properties) {
|
|
452
|
-
properties = {};
|
|
453
|
-
}
|
|
454
|
-
if (id) {
|
|
455
|
-
properties.id = id;
|
|
456
|
-
}
|
|
457
|
-
_self[_DYN_EXCEPTIONS /* @min:%2eexceptions */] = [_createExceptionDetails(logger, exception, properties)];
|
|
458
|
-
_self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);
|
|
459
|
-
_self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);
|
|
460
|
-
if (severityLevel) {
|
|
461
|
-
_self[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */] = severityLevel;
|
|
462
|
-
}
|
|
463
|
-
if (id) {
|
|
464
|
-
_self.id = id;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
else {
|
|
468
|
-
_self[_DYN_EXCEPTIONS /* @min:%2eexceptions */] = exception[_DYN_EXCEPTIONS /* @min:%2eexceptions */] || [];
|
|
469
|
-
_self[_DYN_PROPERTIES /* @min:%2eproperties */] = exception[_DYN_PROPERTIES /* @min:%2eproperties */];
|
|
470
|
-
_self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = exception[_DYN_MEASUREMENTS /* @min:%2emeasurements */];
|
|
471
|
-
if (exception[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */]) {
|
|
472
|
-
_self[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */] = exception[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */];
|
|
473
|
-
}
|
|
474
|
-
if (exception.id) {
|
|
475
|
-
_self.id = exception.id;
|
|
476
|
-
exception[_DYN_PROPERTIES /* @min:%2eproperties */].id = exception.id;
|
|
477
|
-
}
|
|
478
|
-
if (exception[_DYN_PROBLEM_GROUP /* @min:%2eproblemGroup */]) {
|
|
479
|
-
_self[_DYN_PROBLEM_GROUP /* @min:%2eproblemGroup */] = exception[_DYN_PROBLEM_GROUP /* @min:%2eproblemGroup */];
|
|
480
|
-
}
|
|
481
|
-
// bool/int types, use isNullOrUndefined
|
|
482
|
-
if (!isNullOrUndefined(exception.isManual)) {
|
|
483
|
-
_self.isManual = exception.isManual;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
Exception.CreateAutoException = function (message, url, lineNumber, columnNumber, error, evt, stack, errorSrc) {
|
|
488
|
-
var errorType = _getErrorType(error || evt || message);
|
|
489
|
-
return {
|
|
490
|
-
message: _formatMessage(message, errorType),
|
|
491
|
-
url: url,
|
|
492
|
-
lineNumber: lineNumber,
|
|
493
|
-
columnNumber: columnNumber,
|
|
494
|
-
error: _formatErrorCode(error || evt || message),
|
|
495
|
-
evt: _formatErrorCode(evt || message),
|
|
496
|
-
typeName: errorType,
|
|
497
|
-
stackDetails: _getStackFromErrorObj(stack || error || evt),
|
|
498
|
-
errorSrc: errorSrc
|
|
499
|
-
};
|
|
500
|
-
};
|
|
501
|
-
Exception.CreateFromInterface = function (logger, exception, properties, measurements) {
|
|
502
|
-
var exceptions = exception[_DYN_EXCEPTIONS /* @min:%2eexceptions */]
|
|
503
|
-
&& arrMap(exception[_DYN_EXCEPTIONS /* @min:%2eexceptions */], function (ex) { return _createExDetailsFromInterface(logger, ex); });
|
|
504
|
-
var exceptionData = new Exception(logger, __assign(__assign({}, exception), { exceptions: exceptions }), properties, measurements);
|
|
505
|
-
return exceptionData;
|
|
506
|
-
};
|
|
507
|
-
Exception.prototype.toInterface = function () {
|
|
508
|
-
var _a = this, exceptions = _a.exceptions, properties = _a.properties, measurements = _a.measurements, severityLevel = _a.severityLevel, problemGroup = _a.problemGroup, id = _a.id, isManual = _a.isManual;
|
|
509
|
-
var exceptionDetailsInterface = exceptions instanceof Array
|
|
510
|
-
&& arrMap(exceptions, function (exception) { return exception.toInterface(); })
|
|
511
|
-
|| undefined;
|
|
512
|
-
return {
|
|
513
|
-
ver: "4.0",
|
|
514
|
-
exceptions: exceptionDetailsInterface,
|
|
515
|
-
severityLevel: severityLevel,
|
|
516
|
-
properties: properties,
|
|
517
|
-
measurements: measurements,
|
|
518
|
-
problemGroup: problemGroup,
|
|
519
|
-
id: id,
|
|
520
|
-
isManual: isManual
|
|
521
|
-
};
|
|
522
|
-
};
|
|
523
|
-
/**
|
|
524
|
-
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
|
|
525
|
-
*/
|
|
526
|
-
Exception.CreateSimpleException = function (message, typeName, assembly, fileName, details, line) {
|
|
527
|
-
var _a;
|
|
528
|
-
return {
|
|
529
|
-
exceptions: [
|
|
530
|
-
(_a = {},
|
|
531
|
-
_a[_DYN_HAS_FULL_STACK /* @min:hasFullStack */] = true,
|
|
532
|
-
_a.message = message,
|
|
533
|
-
_a.stack = details,
|
|
534
|
-
_a.typeName = typeName,
|
|
535
|
-
_a)
|
|
536
|
-
]
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
|
-
Exception.envelopeType = "Microsoft.ApplicationInsights.{0}.Exception";
|
|
540
|
-
Exception.dataType = "ExceptionData";
|
|
541
|
-
Exception.formatError = _formatErrorCode;
|
|
542
|
-
return Exception;
|
|
543
|
-
}());
|
|
544
|
-
export { Exception };
|
|
545
|
-
var exDetailsAiDataContract = objFreeze({
|
|
546
|
-
id: 0 /* FieldType.Default */,
|
|
547
|
-
outerId: 0 /* FieldType.Default */,
|
|
548
|
-
typeName: 1 /* FieldType.Required */,
|
|
549
|
-
message: 1 /* FieldType.Required */,
|
|
550
|
-
hasFullStack: 0 /* FieldType.Default */,
|
|
551
|
-
stack: 0 /* FieldType.Default */,
|
|
552
|
-
parsedStack: 2 /* FieldType.Array */
|
|
553
|
-
});
|
|
554
|
-
function _toInterface() {
|
|
555
|
-
var _self = this;
|
|
556
|
-
var parsedStack = isArray(_self[_DYN_PARSED_STACK /* @min:%2eparsedStack */])
|
|
557
|
-
&& arrMap(_self[_DYN_PARSED_STACK /* @min:%2eparsedStack */], function (frame) { return _parsedFrameToInterface(frame); });
|
|
558
|
-
var exceptionDetailsInterface = {
|
|
559
|
-
id: _self.id,
|
|
560
|
-
outerId: _self.outerId,
|
|
561
|
-
typeName: _self[_DYN_TYPE_NAME /* @min:%2etypeName */],
|
|
562
|
-
message: _self[_DYN_MESSAGE /* @min:%2emessage */],
|
|
563
|
-
hasFullStack: _self[_DYN_HAS_FULL_STACK /* @min:%2ehasFullStack */],
|
|
564
|
-
stack: _self[strStack],
|
|
565
|
-
parsedStack: parsedStack || undefined
|
|
566
|
-
};
|
|
567
|
-
return exceptionDetailsInterface;
|
|
568
|
-
}
|
|
569
|
-
export function _createExceptionDetails(logger, exception, properties) {
|
|
570
|
-
var _a;
|
|
571
|
-
var id;
|
|
572
|
-
var outerId;
|
|
573
|
-
var typeName;
|
|
574
|
-
var message;
|
|
575
|
-
var hasFullStack;
|
|
576
|
-
var theStack;
|
|
577
|
-
var parsedStack;
|
|
578
|
-
if (!_isExceptionDetailsInternal(exception)) {
|
|
579
|
-
var error = exception;
|
|
580
|
-
var evt = error && error.evt;
|
|
581
|
-
if (!isError(error)) {
|
|
582
|
-
error = error[strError] || evt || error;
|
|
583
|
-
}
|
|
584
|
-
typeName = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified;
|
|
585
|
-
message = dataSanitizeMessage(logger, _formatMessage(exception || error, typeName)) || strNotSpecified;
|
|
586
|
-
var stack = exception[strStackDetails] || _getStackFromErrorObj(exception);
|
|
587
|
-
parsedStack = _parseStack(stack);
|
|
588
|
-
// after parsedStack is inited, iterate over each frame object, sanitize its assembly field
|
|
589
|
-
if (isArray(parsedStack)) {
|
|
590
|
-
arrMap(parsedStack, function (frame) {
|
|
591
|
-
frame[_DYN_ASSEMBLY /* @min:%2eassembly */] = dataSanitizeString(logger, frame[_DYN_ASSEMBLY /* @min:%2eassembly */]);
|
|
592
|
-
frame[_DYN_FILE_NAME /* @min:%2efileName */] = dataSanitizeString(logger, frame[_DYN_FILE_NAME /* @min:%2efileName */]);
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
theStack = dataSanitizeException(logger, _formatStackTrace(stack));
|
|
596
|
-
hasFullStack = isArray(parsedStack) && parsedStack[_DYN_LENGTH /* @min:%2elength */] > 0;
|
|
597
|
-
if (properties) {
|
|
598
|
-
properties[_DYN_TYPE_NAME /* @min:%2etypeName */] = properties[_DYN_TYPE_NAME /* @min:%2etypeName */] || typeName;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
else {
|
|
602
|
-
typeName = exception[_DYN_TYPE_NAME /* @min:%2etypeName */];
|
|
603
|
-
message = exception[_DYN_MESSAGE /* @min:%2emessage */];
|
|
604
|
-
theStack = exception[strStack];
|
|
605
|
-
parsedStack = exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */] || [];
|
|
606
|
-
hasFullStack = exception[_DYN_HAS_FULL_STACK /* @min:%2ehasFullStack */];
|
|
607
|
-
}
|
|
608
|
-
return _a = {},
|
|
609
|
-
_a[_DYN_AI_DATA_CONTRACT /* @min:aiDataContract */] = exDetailsAiDataContract,
|
|
610
|
-
_a.id = id,
|
|
611
|
-
_a.outerId = outerId,
|
|
612
|
-
_a.typeName = typeName,
|
|
613
|
-
_a.message = message,
|
|
614
|
-
_a[_DYN_HAS_FULL_STACK /* @min:hasFullStack */] = hasFullStack,
|
|
615
|
-
_a.stack = theStack,
|
|
616
|
-
_a.parsedStack = parsedStack,
|
|
617
|
-
_a.toInterface = _toInterface,
|
|
618
|
-
_a;
|
|
619
|
-
}
|
|
620
|
-
export function _createExDetailsFromInterface(logger, exception) {
|
|
621
|
-
var parsedStack = (isArray(exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */])
|
|
622
|
-
&& arrMap(exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */], function (frame) { return _stackFrameFromInterface(frame); }))
|
|
623
|
-
|| exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */];
|
|
624
|
-
var exceptionDetails = _createExceptionDetails(logger, __assign(__assign({}, exception), { parsedStack: parsedStack }));
|
|
625
|
-
return exceptionDetails;
|
|
626
|
-
}
|
|
627
|
-
function _parseFilename(theFrame, fileName) {
|
|
628
|
-
var lineCol = fileName[_DYN_MATCH /* @min:%2ematch */](PARSE_FILENAME_LINE_COL);
|
|
629
|
-
if (lineCol && lineCol[_DYN_LENGTH /* @min:%2elength */] >= 4) {
|
|
630
|
-
theFrame[_DYN_FILE_NAME /* @min:%2efileName */] = lineCol[1];
|
|
631
|
-
theFrame[_DYN_LINE /* @min:%2eline */] = parseInt(lineCol[2]);
|
|
632
|
-
}
|
|
633
|
-
else {
|
|
634
|
-
var lineNo = fileName[_DYN_MATCH /* @min:%2ematch */](PARSE_FILENAME_LINE_ONLY);
|
|
635
|
-
if (lineNo && lineNo[_DYN_LENGTH /* @min:%2elength */] >= 3) {
|
|
636
|
-
theFrame[_DYN_FILE_NAME /* @min:%2efileName */] = lineNo[1];
|
|
637
|
-
theFrame[_DYN_LINE /* @min:%2eline */] = parseInt(lineNo[2]);
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
theFrame[_DYN_FILE_NAME /* @min:%2efileName */] = fileName;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
function _handleFilename(theFrame, sequence, matches) {
|
|
645
|
-
var filename = theFrame[_DYN_FILE_NAME /* @min:%2efileName */];
|
|
646
|
-
if (sequence.fn && matches && matches[_DYN_LENGTH /* @min:%2elength */] > sequence.fn) {
|
|
647
|
-
if (sequence.ln && matches[_DYN_LENGTH /* @min:%2elength */] > sequence.ln) {
|
|
648
|
-
filename = strTrim(matches[sequence.fn] || "");
|
|
649
|
-
theFrame[_DYN_LINE /* @min:%2eline */] = parseInt(strTrim(matches[sequence.ln] || "")) || 0;
|
|
650
|
-
}
|
|
651
|
-
else {
|
|
652
|
-
filename = strTrim(matches[sequence.fn] || "");
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
if (filename) {
|
|
656
|
-
_parseFilename(theFrame, filename);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
function _isStackFrame(frame) {
|
|
660
|
-
var result = false;
|
|
661
|
-
if (frame && isString(frame)) {
|
|
662
|
-
var trimmedFrame = strTrim(frame);
|
|
663
|
-
if (trimmedFrame) {
|
|
664
|
-
result = IS_FRAME.test(trimmedFrame);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
return result;
|
|
668
|
-
}
|
|
669
|
-
var stackFrameAiDataContract = objFreeze({
|
|
670
|
-
level: 1 /* FieldType.Required */,
|
|
671
|
-
method: 1 /* FieldType.Required */,
|
|
672
|
-
assembly: 0 /* FieldType.Default */,
|
|
673
|
-
fileName: 0 /* FieldType.Default */,
|
|
674
|
-
line: 0 /* FieldType.Default */
|
|
675
|
-
});
|
|
676
|
-
export function _extractStackFrame(frame, level) {
|
|
677
|
-
var _a;
|
|
678
|
-
var theFrame;
|
|
679
|
-
if (frame && isString(frame) && strTrim(frame)) {
|
|
680
|
-
theFrame = (_a = {},
|
|
681
|
-
_a[_DYN_AI_DATA_CONTRACT /* @min:aiDataContract */] = stackFrameAiDataContract,
|
|
682
|
-
_a.level = level,
|
|
683
|
-
_a.assembly = strTrim(frame),
|
|
684
|
-
_a.method = NoMethod,
|
|
685
|
-
_a.fileName = "",
|
|
686
|
-
_a.line = 0,
|
|
687
|
-
_a.sizeInBytes = 0,
|
|
688
|
-
_a);
|
|
689
|
-
var idx = 0;
|
|
690
|
-
while (idx < _parseSequence[_DYN_LENGTH /* @min:%2elength */]) {
|
|
691
|
-
var sequence = _parseSequence[idx];
|
|
692
|
-
if (sequence.chk && !sequence.chk(frame)) {
|
|
693
|
-
break;
|
|
694
|
-
}
|
|
695
|
-
if (sequence.pre) {
|
|
696
|
-
frame = sequence.pre(frame);
|
|
697
|
-
}
|
|
698
|
-
// Attempt to "parse" the stack frame
|
|
699
|
-
var matches = frame[_DYN_MATCH /* @min:%2ematch */](sequence.re);
|
|
700
|
-
if (matches && matches[_DYN_LENGTH /* @min:%2elength */] >= sequence.len) {
|
|
701
|
-
if (sequence.m) {
|
|
702
|
-
theFrame.method = strTrim(matches[sequence.m] || NoMethod);
|
|
703
|
-
}
|
|
704
|
-
if (sequence.hdl) {
|
|
705
|
-
// Run any custom handler
|
|
706
|
-
sequence.hdl(theFrame, sequence, matches);
|
|
707
|
-
}
|
|
708
|
-
else if (sequence.fn) {
|
|
709
|
-
if (sequence.ln) {
|
|
710
|
-
theFrame[_DYN_FILE_NAME /* @min:%2efileName */] = strTrim(matches[sequence.fn] || "");
|
|
711
|
-
theFrame[_DYN_LINE /* @min:%2eline */] = parseInt(strTrim(matches[sequence.ln] || "")) || 0;
|
|
712
|
-
}
|
|
713
|
-
else {
|
|
714
|
-
_parseFilename(theFrame, matches[sequence.fn] || "");
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
// We found a match so stop looking
|
|
718
|
-
break;
|
|
719
|
-
}
|
|
720
|
-
idx++;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
return _populateFrameSizeInBytes(theFrame);
|
|
724
|
-
}
|
|
725
|
-
function _stackFrameFromInterface(frame) {
|
|
726
|
-
var _a;
|
|
727
|
-
var parsedFrame = (_a = {},
|
|
728
|
-
_a[_DYN_AI_DATA_CONTRACT /* @min:aiDataContract */] = stackFrameAiDataContract,
|
|
729
|
-
_a.level = frame.level,
|
|
730
|
-
_a.method = frame.method,
|
|
731
|
-
_a.assembly = frame[_DYN_ASSEMBLY /* @min:%2eassembly */],
|
|
732
|
-
_a.fileName = frame[_DYN_FILE_NAME /* @min:%2efileName */],
|
|
733
|
-
_a.line = frame[_DYN_LINE /* @min:%2eline */],
|
|
734
|
-
_a.sizeInBytes = 0,
|
|
735
|
-
_a);
|
|
736
|
-
return _populateFrameSizeInBytes(parsedFrame);
|
|
737
|
-
}
|
|
738
|
-
function _populateFrameSizeInBytes(frame) {
|
|
739
|
-
var sizeInBytes = STACKFRAME_BASE_SIZE;
|
|
740
|
-
if (frame) {
|
|
741
|
-
sizeInBytes += frame.method[_DYN_LENGTH /* @min:%2elength */];
|
|
742
|
-
sizeInBytes += frame.assembly[_DYN_LENGTH /* @min:%2elength */];
|
|
743
|
-
sizeInBytes += frame.fileName[_DYN_LENGTH /* @min:%2elength */];
|
|
744
|
-
sizeInBytes += frame.level.toString()[_DYN_LENGTH /* @min:%2elength */];
|
|
745
|
-
sizeInBytes += frame.line.toString()[_DYN_LENGTH /* @min:%2elength */];
|
|
746
|
-
frame[_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */] = sizeInBytes;
|
|
747
|
-
}
|
|
748
|
-
return frame;
|
|
749
|
-
}
|
|
750
|
-
export function _parsedFrameToInterface(frame) {
|
|
751
|
-
return {
|
|
752
|
-
level: frame.level,
|
|
753
|
-
method: frame.method,
|
|
754
|
-
assembly: frame[_DYN_ASSEMBLY /* @min:%2eassembly */],
|
|
755
|
-
fileName: frame[_DYN_FILE_NAME /* @min:%2efileName */],
|
|
756
|
-
line: frame[_DYN_LINE /* @min:%2eline */]
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
//# sourceMappingURL=Exception.js.map
|