glitchgrab 1.24.0 → 1.25.0
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 +14 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -454,6 +454,20 @@ import { GlitchgrabErrorBoundary } from "glitchgrab";
|
|
|
454
454
|
| `onError` | `(error: Error) => void` | - | Called on unhandled errors |
|
|
455
455
|
| `onReportSent` | `(result: ReportResult) => void` | - | Called after a report is sent |
|
|
456
456
|
| `fallback` | `ReactNode` | - | Error boundary fallback UI |
|
|
457
|
+
| `ignoreErrors` | `(string \| RegExp)[]` | - | Skip auto-capture for errors whose message matches (substring for `string`, `.test()` for `RegExp`) |
|
|
458
|
+
|
|
459
|
+
### Ignoring known-noisy errors
|
|
460
|
+
|
|
461
|
+
Some errors that reach `window.onerror` aren't app bugs — browser extension bridges (Grammarly, password managers, etc.) can throw errors that look like they come from your page. If you keep seeing the same non-actionable signature auto-filed as a report, suppress it:
|
|
462
|
+
|
|
463
|
+
```tsx
|
|
464
|
+
<GlitchgrabProvider
|
|
465
|
+
token={process.env.NEXT_PUBLIC_GLITCHGRAB_TOKEN!}
|
|
466
|
+
ignoreErrors={[/Object Not Found Matching Id.*MethodName:update/]}
|
|
467
|
+
>
|
|
468
|
+
{children}
|
|
469
|
+
</GlitchgrabProvider>
|
|
470
|
+
```
|
|
457
471
|
|
|
458
472
|
## Do I need a Content-Security-Policy allowance?
|
|
459
473
|
|
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,12 @@ interface GlitchgrabConfig {
|
|
|
12
12
|
breadcrumbs?: boolean;
|
|
13
13
|
/** Max breadcrumbs to keep (default: 50) */
|
|
14
14
|
maxBreadcrumbs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Skip auto-capture for errors matching any of these patterns (checked against the
|
|
17
|
+
* error message). String = substring match, RegExp = `.test()`. Use for known-noisy
|
|
18
|
+
* signatures that aren't app bugs — e.g. browser extension bridge errors.
|
|
19
|
+
*/
|
|
20
|
+
ignoreErrors?: (string | RegExp)[];
|
|
15
21
|
}
|
|
16
22
|
type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
|
|
17
23
|
type ReportSeverity = "low" | "medium" | "high";
|
|
@@ -91,6 +97,12 @@ interface GlitchgrabProviderProps {
|
|
|
91
97
|
types?: ReportType[];
|
|
92
98
|
/** Show severity picker for BUG type (default: true) */
|
|
93
99
|
showSeverity?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Skip auto-capture for errors matching any of these patterns (checked against the
|
|
102
|
+
* error message). String = substring match, RegExp = `.test()`. Use for known-noisy
|
|
103
|
+
* signatures that aren't app bugs — e.g. browser extension bridge errors.
|
|
104
|
+
*/
|
|
105
|
+
ignoreErrors?: (string | RegExp)[];
|
|
94
106
|
}
|
|
95
107
|
interface ReportButtonProps {
|
|
96
108
|
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ interface GlitchgrabConfig {
|
|
|
12
12
|
breadcrumbs?: boolean;
|
|
13
13
|
/** Max breadcrumbs to keep (default: 50) */
|
|
14
14
|
maxBreadcrumbs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Skip auto-capture for errors matching any of these patterns (checked against the
|
|
17
|
+
* error message). String = substring match, RegExp = `.test()`. Use for known-noisy
|
|
18
|
+
* signatures that aren't app bugs — e.g. browser extension bridge errors.
|
|
19
|
+
*/
|
|
20
|
+
ignoreErrors?: (string | RegExp)[];
|
|
15
21
|
}
|
|
16
22
|
type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
|
|
17
23
|
type ReportSeverity = "low" | "medium" | "high";
|
|
@@ -91,6 +97,12 @@ interface GlitchgrabProviderProps {
|
|
|
91
97
|
types?: ReportType[];
|
|
92
98
|
/** Show severity picker for BUG type (default: true) */
|
|
93
99
|
showSeverity?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Skip auto-capture for errors matching any of these patterns (checked against the
|
|
102
|
+
* error message). String = substring match, RegExp = `.test()`. Use for known-noisy
|
|
103
|
+
* signatures that aren't app bugs — e.g. browser extension bridge errors.
|
|
104
|
+
*/
|
|
105
|
+
ignoreErrors?: (string | RegExp)[];
|
|
94
106
|
}
|
|
95
107
|
interface ReportButtonProps {
|
|
96
108
|
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
package/dist/index.js
CHANGED
|
@@ -2255,7 +2255,8 @@ function GlitchgrabProviderInner({
|
|
|
2255
2255
|
children,
|
|
2256
2256
|
fallback,
|
|
2257
2257
|
types,
|
|
2258
|
-
showSeverity
|
|
2258
|
+
showSeverity,
|
|
2259
|
+
ignoreErrors
|
|
2259
2260
|
}) {
|
|
2260
2261
|
const visitedPagesRef = (0, import_react2.useRef)([]);
|
|
2261
2262
|
(0, import_react2.useEffect)(() => {
|
|
@@ -2305,6 +2306,12 @@ function GlitchgrabProviderInner({
|
|
|
2305
2306
|
if (typeof window === "undefined") return;
|
|
2306
2307
|
if (process.env.NODE_ENV === "development") return;
|
|
2307
2308
|
const EXTENSION_ORIGIN_RE = /\b(?:chrome|safari|moz)-extension:\/\//;
|
|
2309
|
+
const matchesIgnore = (message) => {
|
|
2310
|
+
if (!ignoreErrors || ignoreErrors.length === 0) return false;
|
|
2311
|
+
return ignoreErrors.some(
|
|
2312
|
+
(pattern) => pattern instanceof RegExp ? pattern.test(message) : message.includes(pattern)
|
|
2313
|
+
);
|
|
2314
|
+
};
|
|
2308
2315
|
const handleError = (event) => {
|
|
2309
2316
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2310
2317
|
try {
|
|
@@ -2312,6 +2319,9 @@ function GlitchgrabProviderInner({
|
|
|
2312
2319
|
if (isOpaqueCrossOrigin) {
|
|
2313
2320
|
return;
|
|
2314
2321
|
}
|
|
2322
|
+
if (matchesIgnore(event.message)) {
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2315
2325
|
if (event.message === "ResizeObserver loop completed with undelivered notifications." || event.message === "ResizeObserver loop limit exceeded") {
|
|
2316
2326
|
return;
|
|
2317
2327
|
}
|
|
@@ -2363,6 +2373,9 @@ function GlitchgrabProviderInner({
|
|
|
2363
2373
|
if (errMsg === "Script error." || errMsg === "Script error") {
|
|
2364
2374
|
return;
|
|
2365
2375
|
}
|
|
2376
|
+
if (matchesIgnore(errMsg)) {
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2366
2379
|
const errStack = reason instanceof Error ? reason.stack : void 0;
|
|
2367
2380
|
if (errStack && EXTENSION_ORIGIN_RE.test(errStack)) return;
|
|
2368
2381
|
const sig = computeSignature({
|
|
@@ -2406,7 +2419,7 @@ function GlitchgrabProviderInner({
|
|
|
2406
2419
|
};
|
|
2407
2420
|
} catch (e) {
|
|
2408
2421
|
}
|
|
2409
|
-
}, [token, baseUrl, onError, onReportSent, session]);
|
|
2422
|
+
}, [token, baseUrl, onError, onReportSent, session, ignoreErrors]);
|
|
2410
2423
|
const report = (0, import_react2.useCallback)(
|
|
2411
2424
|
async (type, description, metadata) => {
|
|
2412
2425
|
var _a;
|