Show HN: Cancelable async primitives for JavaScript
github.com84 pointsby Mitranim97 comments
async function main() {
try {
await Future.fromError('fail')
}
catch (err) {
console.error('caught:', err)
}
}
In Node, this actually produces an unhandled rejection because Posterus's scheduler uses `process.nextTick` and squeezes into this unnecessary delay. Doesn't happen if you `.catch()` manually or just use Posterus coroutines instead of interoping with async/await, but it highlights the incorrect implementation of async/await in the first place. (Or is the spec at fault?)