@kush_hemant/react-api-monitor 1.0.39 → 1.0.42
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/dist/index.js +28 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -160,12 +160,40 @@ function monitorBeacon() {
|
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
// src/error/autoError.js
|
|
164
|
+
function monitorErrors() {
|
|
165
|
+
window.addEventListener("error", (event) => {
|
|
166
|
+
var _a;
|
|
167
|
+
sendLog({
|
|
168
|
+
type: "error",
|
|
169
|
+
message: event.message,
|
|
170
|
+
stack: (_a = event.error) == null ? void 0 : _a.stack,
|
|
171
|
+
pageUrl: location.href,
|
|
172
|
+
...getMetadata()
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
window.addEventListener(
|
|
176
|
+
"unhandledrejection",
|
|
177
|
+
(event) => {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
sendLog({
|
|
180
|
+
type: "error",
|
|
181
|
+
message: ((_a = event.reason) == null ? void 0 : _a.message) || "Unhandled Promise Rejection",
|
|
182
|
+
stack: (_b = event.reason) == null ? void 0 : _b.stack,
|
|
183
|
+
pageUrl: location.href,
|
|
184
|
+
...getMetadata()
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
163
190
|
// src/network/auto.js
|
|
164
191
|
function startNetworkMonitoring() {
|
|
165
192
|
monitorFetch();
|
|
166
193
|
monitorXHR();
|
|
167
194
|
monitorAxios();
|
|
168
195
|
monitorBeacon();
|
|
196
|
+
monitorErrors();
|
|
169
197
|
}
|
|
170
198
|
|
|
171
199
|
// src/index.js
|