Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Created February 21, 2014 08:05
Show Gist options
  • Select an option

  • Save juliangruber/9130466 to your computer and use it in GitHub Desktop.

Select an option

Save juliangruber/9130466 to your computer and use it in GitHub Desktop.
var wait = require('co-wait');
var http = require('http');
var co = require('co');
co(function*(){
http.createServer(function(req, res){
res.end('hi')
}).listen(8004);
yield wait(1000);
throw new Error('foo');
})(function(err){
console.log('oops')
console.log(arguments)
http.createServer(function(req, res){
res.end('ho')
}).listen(8005);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment