Add some sanity checks for common first-startup issues

This commit is contained in:
Calvin Montgomery 2019-02-10 10:22:16 -08:00
parent 66d81ffb22
commit c6f9b1611e
4 changed files with 67 additions and 1 deletions

View file

@ -488,6 +488,18 @@ module.exports = {
} else {
const server = http.createServer().listen(bind.port, bind.ip);
servers.push(server);
server.on("error", error => {
if (error.code === "EADDRINUSE") {
LOGGER.fatal(
"Could not bind %s: address already in use. Check " +
"whether another application has already bound this " +
"port, or whether another instance of this server " +
"is running.",
id
);
process.exit(1);
}
});
}
uniqueListenAddresses.add(id);