I don't see the problem...
function doSomething() {
return new Promise((resolve,reject)={
setTimeout(reject,100);
})
.catch(() => [])
}
doSomething().then((arg) => console.log(arg));
Re:ES6: The features I'm most excited about
by seniorsassycat on Monday July 06, 2015 @10:15AM
(#9839211)
The problem may have just been the docs. They say .catch and .then can be composed but I didn't see any mention of the behavior.
The spec on mdn[0] doesn't mention asynchronous `then` or `catch` behavior. If the callback in Jquery `Deferred#then` returns a Deferred that deferred will be returned by `then`.
You can 'flip' a failed promise by returning a resolve promise in the fail callback. [0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...