Last active
December 20, 2015 13:59
-
-
Save gkatsev/6143193 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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