usetraceforge 0.1.19 → 0.1.21
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 +25 -15
- package/dist/vue.d.ts +4 -0
- package/dist/vue.js +25 -0
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -102,21 +102,31 @@ const sendSetupHandshake = async () => {
|
|
|
102
102
|
const setupAutoCapture = () => {
|
|
103
103
|
if (autoCaptureInitialized)
|
|
104
104
|
return;
|
|
105
|
-
if (typeof window
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
})
|
|
119
|
-
}
|
|
105
|
+
if (typeof window !== "undefined") {
|
|
106
|
+
window.addEventListener("error", (event) => {
|
|
107
|
+
if (event.error) {
|
|
108
|
+
capture(event.error, { environment: "browser" }).catch(() => undefined);
|
|
109
|
+
}
|
|
110
|
+
else if (event.message) {
|
|
111
|
+
capture(new Error(event.message), { environment: "browser" }).catch(() => undefined);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
window.addEventListener("unhandledrejection", (event) => {
|
|
115
|
+
capture(event.reason ?? new Error("Unhandled promise rejection"), {
|
|
116
|
+
environment: "browser"
|
|
117
|
+
}).catch(() => undefined);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else if (typeof process !== "undefined") {
|
|
121
|
+
process.on("uncaughtException", (error) => {
|
|
122
|
+
capture(error, { environment: "node" }).catch(() => undefined);
|
|
123
|
+
});
|
|
124
|
+
process.on("unhandledRejection", (reason) => {
|
|
125
|
+
capture(reason ?? new Error("Unhandled promise rejection"), {
|
|
126
|
+
environment: "node"
|
|
127
|
+
}).catch(() => undefined);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
120
130
|
autoCaptureInitialized = true;
|
|
121
131
|
};
|
|
122
132
|
const TraceForge = {
|
package/dist/vue.d.ts
ADDED
package/dist/vue.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import TraceForge from "./index.js";
|
|
2
|
+
export const TraceForgeVue = {
|
|
3
|
+
install(app, options) {
|
|
4
|
+
// Initialize TraceForge with autoCapture true by default for Vue apps
|
|
5
|
+
TraceForge.init({
|
|
6
|
+
...options,
|
|
7
|
+
autoCapture: options.autoCapture ?? true,
|
|
8
|
+
});
|
|
9
|
+
const originalErrorHandler = app.config.errorHandler;
|
|
10
|
+
// Hook into Vue's global error handler to capture rendering/lifecycle errors
|
|
11
|
+
app.config.errorHandler = (err, instance, info) => {
|
|
12
|
+
TraceForge.captureException(err, {
|
|
13
|
+
environment: "browser",
|
|
14
|
+
tags: { framework: "vue", vueInfo: info }
|
|
15
|
+
});
|
|
16
|
+
// Call the original error handler if it exists, otherwise log to console
|
|
17
|
+
if (originalErrorHandler) {
|
|
18
|
+
originalErrorHandler(err, instance, info);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.error(err);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usetraceforge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "TraceForge JavaScript SDK for sending errors to a TraceForge ingest endpoint.",
|
|
6
6
|
"type": "module",
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
"import": "./dist/next.js",
|
|
49
49
|
"require": "./dist/next.js",
|
|
50
50
|
"default": "./dist/next.js"
|
|
51
|
+
},
|
|
52
|
+
"./vue": {
|
|
53
|
+
"types": "./dist/vue.d.ts",
|
|
54
|
+
"import": "./dist/vue.js",
|
|
55
|
+
"require": "./dist/vue.js",
|
|
56
|
+
"default": "./dist/vue.js"
|
|
51
57
|
}
|
|
52
58
|
},
|
|
53
59
|
"files": [
|