Merge pull request #582 from IlyaDiallo/510

#510 Detect when the port you try to run the server on is already in use
This commit is contained in:
Drew
2016-02-22 16:29:52 -08:00

View File

@@ -187,6 +187,17 @@ function ParseServer({
api.use(middlewares.handleParseErrors);
process.on('uncaughtException', (err) => {
if( err.code === "EADDRINUSE" ) { // user-friendly message for this common error
console.log(`Unable to listen on port ${err.port}. The port is already in use.`);
process.exit(0);
}
else {
throw err;
}
});
return api;
}