Created
August 27, 2014 12:47
-
-
Save kjunine/b22f60ed28d09f3ba8ad to your computer and use it in GitHub Desktop.
multiple errors in Q.all
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
running second | |
err - first: [Error: second] second: undefined | |
running first |
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
'use strict'; | |
var Q = require('q'); | |
Q.all([ | |
Q.try(function() { | |
return Q.delay(200) | |
.then(function() { | |
console.log('running first'); | |
throw new Error('first'); | |
}); | |
}), | |
Q.try(function() { | |
return Q.delay(100) | |
.then(function() { | |
console.log('running second'); | |
throw new Error('second'); | |
}); | |
}) | |
]).catch(function(first, second) { | |
console.log('err - first:', first, 'second:', second); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment