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/dist/index.mjs CHANGED
@@ -2212,7 +2212,8 @@ function GlitchgrabProviderInner({
2212
2212
  children,
2213
2213
  fallback,
2214
2214
  types,
2215
- showSeverity
2215
+ showSeverity,
2216
+ ignoreErrors
2216
2217
  }) {
2217
2218
  const visitedPagesRef = useRef2([]);
2218
2219
  useEffect2(() => {
@@ -2262,6 +2263,16 @@ function GlitchgrabProviderInner({
2262
2263
  if (typeof window === "undefined") return;
2263
2264
  if (process.env.NODE_ENV === "development") return;
2264
2265
  const EXTENSION_ORIGIN_RE = /\b(?:chrome|safari|moz)-extension:\/\//;
2266
+ const KNOWN_NOISE_RE = [
2267
+ /Object Not Found Matching Id:\d+, MethodName:update, ParamCount:\d+/
2268
+ ];
2269
+ const matchesIgnore = (message) => {
2270
+ if (KNOWN_NOISE_RE.some((pattern) => pattern.test(message))) return true;
2271
+ if (!ignoreErrors || ignoreErrors.length === 0) return false;
2272
+ return ignoreErrors.some(
2273
+ (pattern) => pattern instanceof RegExp ? pattern.test(message) : message.includes(pattern)
2274
+ );
2275
+ };
2265
2276
  const handleError = (event) => {
2266
2277
  var _a, _b, _c, _d, _e, _f, _g;
2267
2278
  try {
@@ -2269,6 +2280,9 @@ function GlitchgrabProviderInner({
2269
2280
  if (isOpaqueCrossOrigin) {
2270
2281
  return;
2271
2282
  }
2283
+ if (matchesIgnore(event.message)) {
2284
+ return;
2285
+ }
2272
2286
  if (event.message === "ResizeObserver loop completed with undelivered notifications." || event.message === "ResizeObserver loop limit exceeded") {
2273
2287
  return;
2274
2288
  }
@@ -2320,6 +2334,9 @@ function GlitchgrabProviderInner({
2320
2334
  if (errMsg === "Script error." || errMsg === "Script error") {
2321
2335
  return;
2322
2336
  }
2337
+ if (matchesIgnore(errMsg)) {
2338
+ return;
2339
+ }
2323
2340
  const errStack = reason instanceof Error ? reason.stack : void 0;
2324
2341
  if (errStack && EXTENSION_ORIGIN_RE.test(errStack)) return;
2325
2342
  const sig = computeSignature({
@@ -2363,7 +2380,7 @@ function GlitchgrabProviderInner({
2363
2380
  };
2364
2381
  } catch (e) {
2365
2382
  }
2366
- }, [token, baseUrl, onError, onReportSent, session]);
2383
+ }, [token, baseUrl, onError, onReportSent, session, ignoreErrors]);
2367
2384
  const report = useCallback(
2368
2385
  async (type, description, metadata) => {
2369
2386
  var _a;