Skip to content

Instantly share code, notes, and snippets.

@kjunine
Created August 27, 2014 12:47
Show Gist options
  • Save kjunine/b22f60ed28d09f3ba8ad to your computer and use it in GitHub Desktop.
Save kjunine/b22f60ed28d09f3ba8ad to your computer and use it in GitHub Desktop.
multiple errors in Q.all
running second
err - first: [Error: second] second: undefined
running first
'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