Skip to content

Instantly share code, notes, and snippets.

@Flackus
Created November 20, 2011 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Flackus/1380665 to your computer and use it in GitHub Desktop.
Save Flackus/1380665 to your computer and use it in GitHub Desktop.
Exceptions
var connect = require('connect');
var server = connect(
connect.cookieParser(),
function(req, res, next) {
// hehe
callToUnknownFunction();
next();
},
connect.router(function(router) {
router.get('/', function(req, res) {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html');
res.end('okay');
});
})
);
process.on('uncaughtException', function(err) {
console.log('Caught exception: ' + err);
});
server.listen(8080, '127.0.0.1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment