wix-incubator / kissfs

Extensible and reactive text-based file-system library that keeps it simple, universal and cross-platform
MIT License
12 stars 5 forks source link

retryPromise: improve flow and avoid bad pattern #94

Closed AviVahl closed 6 years ago

AviVahl commented 7 years ago

No longer creates an empty Promise without any use (async (resolve, reject)=>...). No longer checks and rechecks whether it's in a timout. When timeout value is provided, it creates a single delayed rejected promise and uses it with Promise.race when doing operations. A unique object is used to identify a timeout error. First try was class TimeoutError extends Error {}, but instanceof TimeoutError is false for IE11/Edge.