Improve timeout error message (#24)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
This commit is contained in:
parent
495a0bb923
commit
bf5d1649cc
2
index.js
2
index.js
|
@ -9,7 +9,7 @@ export default function pTimeout(promise, milliseconds, fallback, options) {
|
|||
let timer;
|
||||
const cancelablePromise = new Promise((resolve, reject) => {
|
||||
if (typeof milliseconds !== 'number' || milliseconds < 0) {
|
||||
throw new TypeError('Expected `milliseconds` to be a positive number');
|
||||
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
||||
}
|
||||
|
||||
if (milliseconds === Number.POSITIVE_INFINITY) {
|
||||
|
|
Loading…
Reference in New Issue