diff --git a/index.js b/index.js index ebd6c2d..7b3d79d 100644 --- a/index.js +++ b/index.js @@ -77,12 +77,16 @@ export default function pTimeout(promise, options) { return; } - const errorMessage = typeof message === 'string' ? message : `Promise timed out after ${milliseconds} milliseconds`; - const timeoutError = message instanceof Error ? message : new TimeoutError(errorMessage); - if (typeof promise.cancel === 'function') { promise.cancel(); } + + if (message === false) { + resolve(); + } + + const errorMessage = typeof message === 'string' ? message : `Promise timed out after ${milliseconds} milliseconds`; + const timeoutError = message instanceof Error ? message : new TimeoutError(errorMessage); reject(timeoutError); }, milliseconds);