3 ms·
If a Promise is rejected, what happens to the return value of that Promise's .then() (assuming the onRejected handler doesn't throw)? Is it also rejected (as th
by KerrickStaley 12y ago
If a Promise is rejected, what happens to the return value of that Promise's .then() (assuming the onRejected handler doesn't throw)? Is it also rejected (as the article seems to suggest)? Or is it fulfilled (as the spec indicates, if I'm reading it correctly)?
- domenicd 12y agoIt's fulfilled. If you return from the rejection handler, instead of rethrowing, then you have handled the error: rejectedPromise.catch(e => { return 5; }); is similar to try { throwError(); } catch (e) { return 5; }