Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function foo(id) {
var deferred = q.defer();
bar(id)
.then(function(obj) {
var anotherDeferred = q.defer();
log('fail');
if (obj) {
deferred.reject(new Error('no obj'));
anotherDeferred.reject(new Error('no obj'));
return anotherDeferred.promise;
}
anotherDeferred.resolve();
return anotherDeferred.promise;
})
.then(function() {
log('we got here anyway');
})
.reject(function(error) {
log(error);
deferred.reject(error);
});
return deferred;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.