Skip to content

Commit 687c471

Browse files
author
nicola
committed
fail gracely on port errors in command line
1 parent decbe83 commit 687c471

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)