fix: don't report failed network requests as JavaScript errors (#38732)

On the issue ref popup, when the user clicks the link while fetch is
loading, the page will briefly render a network error message before
loading the next page. Suppress unnecessary network errors.
This commit is contained in:
silverwind
2026-08-03 08:11:22 +02:00
committed by GitHub
parent 6487d14855
commit 89dd456af8
3 changed files with 15 additions and 0 deletions
+5
View File
@@ -1,5 +1,6 @@
// keep this file lightweight, it's imported into IIFE chunk in bootstrap
import {html} from '../utils/html.ts';
import isNetworkError from 'is-network-error';
import type {Intent} from '../types.ts';
/** Extract a message string from an unknown caught value. */
@@ -66,6 +67,10 @@ export function processWindowErrorEvent({error, reason, message, type, filename,
if (window.config.runModeIsProd) return;
}
// Don't show network errors, happens on ref-issue when clicking on the
// issue link while the fetch request is still running.
if (isNetworkError(err)) return;
// Filter out errors from browser extensions or other non-Gitea scripts.
if (!isGiteaError(filename ?? '', err?.stack ?? '')) return;