Tuesday, 4 April 2017

Node.js vs Browser: Chaining rejected promises

If I try this on Chrome Version 56.0.2924.87 (64-bit) - Expected result..

Promise.reject(null).then(console.log);
> Promise {[[PromiseStatus]]: "rejected", [[PromiseValue]]: null}

Whereas if I try on Node v7.8.0 - Potential error?

Promise.reject(null).then(console.log);
> Promise { <pending> }

Am I doing something wrong or is this a bug? (I'm assuming the former)

I'm having trouble mocking rejected promises through a handle chain as the rejection doesn't carry through the chain :(

Looking at the MDN docs I think I've got the syntax correct: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then



via Alex Latchford

No comments:

Post a Comment