Skip to content

Commit cd0379e

Browse files
author
Andrei
committed
Merge pull request #192 from nicola/port-errors
fail gracely on port errors in command line
2 parents ffedaa9 + 687c471 commit cd0379e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎bin/ldnode.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ function bin (argv) {
130130
try {
131131
app = ldnode.createServer(argv)
132132
} catch (e) {
133+
if (e.code === 'EACCES') {
134+
console.log('You need root privileges to start on this port')
135+
return 1
136+
}
137+
if (e.code === 'EADDRINUSE') {
138+
console.log('The port ' + argv.port + ' is already in use')
139+
return 1
140+
}
133141
console.log(e.message)
134142
console.log(e.stack)
135143
return 1

0 commit comments

Comments
 (0)