This code goes into resolve:

Promise.resolve(Promise.reject(123).catch(v => console.log(v))) .then(() => console.log(1), () => console.error(2)) 

But I do not understand why. Before cath, reject is returned. Further catch intercepts it. Thus, the reject is neutralized.

As a result, it is not clear what exactly causes the first handler to work in the then

    1 answer 1

    The .catch method returns a thread of execution to the correct branch.

    To continue to execute the reject branch from .catch you also need to return Promise.reject(...)

     Promise.resolve(Promise.reject(123) .catch(v => Promise.reject(console.log(v)))) .then(() => console.log(1), () => console.error(2))