fix: make fetch error not abort.
This commit is contained in:
parent
2797d1eed4
commit
38106caecf
|
@ -81,6 +81,7 @@ export class ChromePromiseErrorHandler {
|
|||
event.promise.catch((error) => {
|
||||
// 如果`error`是个错误,则继续处理
|
||||
if (error instanceof Error) {
|
||||
if (/Failed to fetch/.test(error.message) || /Failed to load because no supported source was found/.test(error.message)) return;
|
||||
// 如果已经处理过该错误,则不再处理
|
||||
if (this.#errorList.includes(error)) return;
|
||||
this.#errorList.push(error);
|
||||
|
|
|
@ -18,6 +18,8 @@ export class FirefoxPromiseErrorHandler {
|
|||
onHandle(event) {
|
||||
event.promise.catch((error) => {
|
||||
if (typeof error === "object" && error instanceof Error) {
|
||||
if (/Failed to fetch/.test(error.message) || /The media resource indicated by the src attribute or assigned media provider object was not suitable/.test(error.message)) return;
|
||||
|
||||
// Firefox在大环境下默认情况必须要那么多ts-ignore
|
||||
// @ts-ignore
|
||||
window.onerror(
|
||||
|
|
|
@ -20,6 +20,7 @@ export class UnknownPromiseErrorHandler {
|
|||
onHandle(event) {
|
||||
event.promise.catch((error) => {
|
||||
if (typeof error === "object" && error instanceof Error) {
|
||||
if (/Failed to fetch/.test(error.message)) return;
|
||||
// 很遗憾,因浏览器问题,你只能看到这一段
|
||||
throw error;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue