Improve timeout error message (#24)

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
This commit is contained in:
Kiko Beats 2021-10-08 08:15:55 +02:00 committed by GitHub
parent 495a0bb923
commit bf5d1649cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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) {