Too long unresolved promise is tired and I gonna give up.
This is the promise with timeout.
yarn add promise-until-tired
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
}
}