0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-27 22:59:51 -05:00

catch bind errors

This commit is contained in:
Alex Kocharin 2013-12-19 07:17:52 +04:00
parent 225c2bb65f
commit 503b60a45b

View file

@ -98,7 +98,13 @@ function afterConfigLoad() {
logger.setup(config.logs)
var hostport = get_hostport()
server(config).listen(hostport[1], hostport[0])
server(config)
.listen(hostport[1], hostport[0])
.on('error', function(err) {
logger.logger.fatal({err: err}, 'cannot create server: @{err.message}')
process.exit(2)
})
logger.logger.warn({addr: 'http://'+hostport[0]+':'+hostport[1]+'/', version: 'Sinopia/'+pkg.version}, 'Server is listening on @{addr}')
// undocumented stuff for tests