I have seen something in our codebase while refactoring coffeescript->js and I am a bit anxious if I break something if I change it, I haven't seen return Promise.reject(new Error('not found'));
before
// This is old code
somePromise()
.then(function (res) {
if ((res == null)) { return Promise.reject(new Error('not found')); }
return 'found'
})
somePromise()
.then(function (res) {
if ((res == null)) { throw new Error('not found'); }
return 'found'
})