I write books about programming --> https://shop.jcoglan.com/
try {
let result = await promise
a(result)
} catch (error)
b(error)
} finally {
c()
}
why this is not exactly equivalent to the thing I was doing originally is beyond me
try {
let result = await promise
a(result)
} catch (error)
b(error)
} finally {
c()
}
why this is not exactly equivalent to the thing I was doing originally is beyond me
promise.then(a, b)
promise.finally(c)
with:
promise.then((x) => {
a(x)
c()
}, (y) => {
b(y)
c()
})
maintains the execution order of the original program and does not have the weird side effect of actually using finally(), but it assumes a() and b() do not throw
promise.then(a, b)
promise.finally(c)
with:
promise.then((x) => {
a(x)
c()
}, (y) => {
b(y)
c()
})
maintains the execution order of the original program and does not have the weird side effect of actually using finally(), but it assumes a() and b() do not throw