try to workaround got issue with unhandledRejection (#6230)

This commit is contained in:
Dotan Simha 2025-01-02 11:48:49 +02:00 committed by GitHub
parent b1be810625
commit dc606ffe0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 653 additions and 262 deletions

View file

@ -125,7 +125,8 @@
"@graphiql/react": "patches/@graphiql__react.patch",
"countup.js": "patches/countup.js.patch",
"@oclif/core@4.0.6": "patches/@oclif__core@4.0.6.patch",
"@fastify/vite": "patches/@fastify__vite.patch"
"@fastify/vite": "patches/@fastify__vite.patch",
"p-cancelable@4.0.1": "patches/p-cancelable@4.0.1.patch"
}
}
}

View file

@ -0,0 +1,17 @@
diff --git a/index.js b/index.js
index c48660ea0f74f3d61c2ab8d57f139f7c115e91de..651b5a7d30656c8f41291b3a978b0b5f0a7ad62f 100644
--- a/index.js
+++ b/index.js
@@ -50,7 +50,11 @@ export default class PCancelable {
const onCancel = handler => {
if (this.#state !== promiseState.pending) {
- throw new Error(`The \`onCancel\` handler was attached after the promise ${this.#state.description}.`);
+ console.error(
+ `The \`onCancel\` handler was attached after the promise ${this.#state.description}.`,
+ );
+
+ return;
}
this.#cancelHandlers.push(handler);

File diff suppressed because it is too large Load diff