Better error handling for when website cannot start listening on configured port

This commit is contained in:
Matt 2014-05-07 11:59:37 -06:00
parent 3fb907f682
commit 57462c3de1
1 changed files with 9 additions and 3 deletions

View File

@ -274,9 +274,15 @@ module.exports = function(logger){
res.send(500, 'Something broke!');
});
app.listen(portalConfig.website.port, function(){
logger.debug(logSystem, 'Server', 'Website started on port ' + portalConfig.website.port);
});
try {
app.listen(portalConfig.website.port, function () {
logger.debug(logSystem, 'Server', 'Website started on port ' + portalConfig.website.port);
});
}
catch(e){
logger.error(logSystem, 'Server', 'Could not start website on port ' + portalConfig.website.port
+ ' - its either in use or you do not have permission');
}
};