Add error handler

If the server fails to start, display error message and exit.  Typically this is due to the address being in use.
This commit is contained in:
Tim Schaub
2014-01-10 12:05:38 -07:00
parent 251ebbcbac
commit 2b8e87f17f

View File

@@ -43,4 +43,8 @@ manager.on('ready', function() {
server.listen(3000, function() {
log.info('ol', 'Listening on http://localhost:3000/ (Ctrl+C to stop)');
});
server.on('error', function(err) {
log.error('ol', 'Server failed to start: ' + err.message);
process.exit(1);
});
});