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);