substantial / sinon-stub-promise

Synchronous Promise stubbing for Sinon.JS
MIT License
85 stars 11 forks source link

Make sure catch catches errors #13

Closed andysprout closed 8 years ago

andysprout commented 8 years ago

In this example https://tonicdev.com/570b58feacaa9d11003f795b/570b58feacaa9d11003f795c

promise.resolve()
    .then(() => {throw new Error()})
    .catch(() => 'no error')
    .then(a => console.log(a));

the catch method successfully catches the error and returns 'no error' which is passed to the final then.

Before this diff, the second then would not be called.

a-b-r-o-w-n commented 8 years ago

Thanks. I'll take a look at this today.

a-b-r-o-w-n commented 8 years ago

Merge in 9a0d8fd