mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
show an error when port is already in use - fixes #42
This commit is contained in:
parent
413254bfa4
commit
5ba9a47948
4 changed files with 24 additions and 2 deletions
|
|
@ -27,6 +27,10 @@ function (http, nodeStatic) {
|
|||
//console.log("data")
|
||||
});
|
||||
|
||||
req.addListener('error', function(err) {
|
||||
console.log('');
|
||||
});
|
||||
|
||||
req.addListener('end', function () {
|
||||
|
||||
switch(true) {
|
||||
|
|
@ -67,6 +71,15 @@ function (http, nodeStatic) {
|
|||
});
|
||||
}
|
||||
);
|
||||
|
||||
this.server.once('error', function(err) {
|
||||
if(err.code == 'EADDRINUSE') {
|
||||
console.error('port already in use. Closing.');
|
||||
} else {
|
||||
throw new Error(err);
|
||||
}
|
||||
});
|
||||
|
||||
this.server.listen(options.port);
|
||||
|
||||
console.checkpoint('start HTTP server');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue