mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-04 10:47:35 +00:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user