Regular behavior is (you reject with a ```js Promise.resolve(3).then(console.log.bind(console)) // logs 3 Promise.reject(3).catch(console.log.bind(console)) // logs 3 ```
`Promise.resolve()` only unwraps promises passed to it, because that is needed for chaining: ```js asyncFunc1() .then(result1 => asyncFunc2()) // (A) .then(result2 => console.log(result2)); ``` `then` in line (A) returns a promise that is resolved with what its callback returns. Because resolving unwraps, `asyncFunc2` can return a promise and `result2` will contain the result of resolving it (which is what you want for chaining). > On 28 Dec 2014, at 13:44, raul mihaila <[email protected]> wrote: > > Can somebody please provide a rationale for why promise reject functions > don't resolve the argument, if the argument is a promise, before they pass it > to the handlers, like promise resolve functions do? > > Promise.resolve(Promise.reject(3)).catch(console.log.bind(console)) // logs 3 > Promise.reject(Promise.resolve(2)).catch(console.log.bind(console)) // logs a > promise -- Dr. Axel Rauschmayer [email protected] rauschma.de
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

