glitchgrab 1.24.0 → 1.26.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 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,16 @@ 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 KNOWN_NOISE_RE = [
2310
+ /Object Not Found Matching Id:\d+, MethodName:update, ParamCount:\d+/
2311
+ ];
2312
+ const matchesIgnore = (message) => {
2313
+ if (KNOWN_NOISE_RE.some((pattern) => pattern.test(message))) return true;
2314
+ if (!ignoreErrors || ignoreErrors.length === 0) return false;
2315
+ return ignoreErrors.some(
2316
+ (pattern) => pattern instanceof RegExp ? pattern.test(message) : message.includes(pattern)
2317
+ );
2318
+ };
2308
2319
  const handleError = (event) => {
2309
2320
  var _a, _b, _c, _d, _e, _f, _g;
2310
2321
  try {
@@ -2312,6 +2323,9 @@ function GlitchgrabProviderInner({
2312
2323
  if (isOpaqueCrossOrigin) {
2313
2324
  return;
2314
2325
  }
2326
+ if (matchesIgnore(event.message)) {
2327
+ return;
2328
+ }
2315
2329
  if (event.message === "ResizeObserver loop completed with undelivered notifications." || event.message === "ResizeObserver loop limit exceeded") {
2316
2330
  return;
2317
2331
  }
@@ -2363,6 +2377,9 @@ function GlitchgrabProviderInner({
2363
2377
  if (errMsg === "Script error." || errMsg === "Script error") {
2364
2378
  return;
2365
2379
  }
2380
+ if (matchesIgnore(errMsg)) {
2381
+ return;
2382
+ }
2366
2383
  const errStack = reason instanceof Error ? reason.stack : void 0;
2367
2384
  if (errStack && EXTENSION_ORIGIN_RE.test(errStack)) return;
2368
2385
  const sig = computeSignature({
@@ -2406,7 +2423,7 @@ function GlitchgrabProviderInner({
2406
2423
  };
2407
2424
  } catch (e) {
2408
2425
  }
2409
- }, [token, baseUrl, onError, onReportSent, session]);
2426
+ }, [token, baseUrl, onError, onReportSent, session, ignoreErrors]);
2410
2427
  const report = (0, import_react2.useCallback)(
2411
2428
  async (type, description, metadata) => {
2412
2429
  var _a;