function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error('Port ' + port + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error('Port ' + port + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
onError = (error) ->
throw error if error.syscall isnt 'listen'
# handle specific listen errors with friendly messages
switch error.code
when 'EACCES'
console.error 'Port ' + port + ' requires elevated privileges'
process.exit 1
when 'EADDRINUSE'
console.error 'Port ' + port + ' is already in use'
process.exit 1
else
throw error