promise-until-tired
v1.0.1
Published
[](https://github.com/semantic-release/semantic-release) [](https
Readme
Promise until tired
Too long unresolved promise is tired and I gonna give up.
This is the promise with timeout.
Installation
yarn add promise-until-tiredUsage
import newPromiseUntilTired, { TiredFromWaitingPromiseResolveTooLongError } from 'promise-until-tired'
try {
const value = await newPromiseUntilTired((resolve, reject) => {
// logic
}, timeout)
} catch (error) {
if (error instanceof TiredFromWaitingPromiseResolveTooLongError) {
// handle timeout logic
} else {
// handle other reject logic
}
}