bugvaulty 1.0.1 → 1.0.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/README.md +34 -2
- package/package.json +2 -3
- package/src/errorCatcher.js +5 -1
- package/src/index.js +2 -0
package/README.md
CHANGED
|
@@ -110,6 +110,35 @@ BugVaulty automatically catches:
|
|
|
110
110
|
- `process.on('unhandledRejection')`
|
|
111
111
|
- Express route errors via `expressMiddleware()`
|
|
112
112
|
|
|
113
|
+
## Vanilla Node (no Express)
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
const bugvaulty = require('bugvaulty');
|
|
117
|
+
|
|
118
|
+
bugvaulty.init({
|
|
119
|
+
notionToken: process.env.BUGVAULTY_NOTION_TOKEN,
|
|
120
|
+
notionPageId: process.env.BUGVAULTY_NOTION_PAGE_ID,
|
|
121
|
+
ai: {
|
|
122
|
+
provider: process.env.BUGVAULTY_AI_PROVIDER || 'groq',
|
|
123
|
+
apiKey: process.env.BUGVAULTY_AI_API_KEY,
|
|
124
|
+
},
|
|
125
|
+
capture: {
|
|
126
|
+
// For cleaner demos: track console.error without printing to terminal
|
|
127
|
+
consoleErrors: 'track-only',
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Auto-captured by process handlers
|
|
132
|
+
Promise.reject(new Error('Unhandled rejection test'));
|
|
133
|
+
|
|
134
|
+
// Manual tracking for caught errors
|
|
135
|
+
try {
|
|
136
|
+
JSON.parse('{invalid');
|
|
137
|
+
} catch (err) {
|
|
138
|
+
bugvaulty.trackError(err, { source: 'manual.catch' });
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
113
142
|
## React integration
|
|
114
143
|
|
|
115
144
|
```jsx
|
|
@@ -235,7 +264,7 @@ init({
|
|
|
235
264
|
capture?: {
|
|
236
265
|
processWarnings?: boolean,
|
|
237
266
|
multipleResolves?: boolean,
|
|
238
|
-
consoleErrors?: boolean
|
|
267
|
+
consoleErrors?: boolean | 'track-only'
|
|
239
268
|
}
|
|
240
269
|
})
|
|
241
270
|
```
|
|
@@ -250,10 +279,13 @@ Returns standard Express error middleware `(err, req, res, next)`.
|
|
|
250
279
|
### `trackReactError(error, context?)`
|
|
251
280
|
Used internally by `BugVaultyProvider`, but exported for advanced cases.
|
|
252
281
|
|
|
282
|
+
### `trackError(error, context?)`
|
|
283
|
+
Manual error tracking for Node/vanilla/caught errors.
|
|
284
|
+
|
|
253
285
|
## Notes
|
|
254
286
|
|
|
255
287
|
- Keys are stored only in memory from `init()` config.
|
|
256
288
|
- BugVaulty does not require manual error reporting after setup.
|
|
257
289
|
- To let BugVaulty create pages under a parent page, your integration must have access to that page in Notion.
|
|
258
290
|
- React integration requires `react` in your app.
|
|
259
|
-
# bug-vaulty
|
|
291
|
+
# bug-vaulty
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugvaulty",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Automatically track errors to Notion with AI solutions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@notionhq/client": "^2.2.15",
|
|
31
|
-
"axios": "^1.6.0"
|
|
32
|
-
"bugvaulty": "^1.0.0"
|
|
31
|
+
"axios": "^1.6.0"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
34
|
"react": ">=16.0.0"
|
package/src/errorCatcher.js
CHANGED
|
@@ -49,9 +49,12 @@ function patchConsoleError(onError, options) {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
const trackOnly = options.consoleErrors === 'track-only';
|
|
52
53
|
originalConsoleError = console.error;
|
|
53
54
|
console.error = function patchedConsoleError(...args) {
|
|
54
|
-
|
|
55
|
+
if (!trackOnly) {
|
|
56
|
+
originalConsoleError.apply(console, args);
|
|
57
|
+
}
|
|
55
58
|
|
|
56
59
|
const firstError = args.find((arg) => arg instanceof Error);
|
|
57
60
|
const firstString = args.find((arg) => typeof arg === 'string');
|
|
@@ -60,6 +63,7 @@ function patchConsoleError(onError, options) {
|
|
|
60
63
|
safeHandle(onError, tracked, {
|
|
61
64
|
source: 'console.error',
|
|
62
65
|
preview: firstString ? String(firstString).slice(0, 500) : '',
|
|
66
|
+
terminalOutputSuppressed: trackOnly,
|
|
63
67
|
});
|
|
64
68
|
};
|
|
65
69
|
|
package/src/index.js
CHANGED
|
@@ -88,6 +88,7 @@ function init(options) {
|
|
|
88
88
|
|
|
89
89
|
return {
|
|
90
90
|
expressMiddleware,
|
|
91
|
+
trackError,
|
|
91
92
|
trackReactError,
|
|
92
93
|
};
|
|
93
94
|
}
|
|
@@ -209,5 +210,6 @@ function trackReactError(errorLike, context) {
|
|
|
209
210
|
module.exports = {
|
|
210
211
|
init,
|
|
211
212
|
expressMiddleware,
|
|
213
|
+
trackError,
|
|
212
214
|
trackReactError,
|
|
213
215
|
};
|