I have the following codes:
function promise3() {
return new Promise((resolve, reject) => {
function1().then(() => {
resolve();
}).catch(err => {
reject(err);
console.log("after error");
});
})
}
promise3().catch(e => {
console.log(e);
});
function1
returns a promise. But when function1
fails and returns an error. I see the console.log("after error")
before the console.log of the error. I though the codes after reject
would not run. reject
acts like a return. What is happening here then?