Skip to content

Instantly share code, notes, and snippets.

@nrstott
Created December 7, 2011 18:57
Show Gist options
  • Select an option

  • Save nrstott/1444106 to your computer and use it in GitHub Desktop.

Select an option

Save nrstott/1444106 to your computer and use it in GitHub Desktop.
var q = require('q');
var a = q.defer();
var b = q.defer();
q.when(a, function() {
console.log('calling b');
return q.when(b, function() {
console.log('throwing');
throw new Error('Hello World');
});
}, function() {
console.log('handling error');
});
b.resolve('hi');
a.resolve('yo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment