diff --git a/src/throttlePromise.ts b/src/throttlePromise.ts index 45cbc583..b80507a9 100644 --- a/src/throttlePromise.ts +++ b/src/throttlePromise.ts @@ -30,8 +30,13 @@ function throttledQueue) => ReturnType>( const x = queue.shift(); if (x) { - const res = await fn(...x.args); - x.resolve(res); + try { + const res = await fn(...x.args); + x.resolve(res); + } + catch (error) { + x.reject(error); + } } const id = setTimeout(() => {