server.js 3/4
Tue Sep 07 2021 19:33:11 GMT+0000 (Coordinated Universal Time)
Saved by
@devdave
// [3] ERROR SECT.
const errorHandler = (error) => {
if (error.syscall !== "listen") {
throw error;
}
const address = server.address();
const bind =
typeof address === "string" ? "pipe " + address : "port: " + port;
switch (error.code) {
case "EACCES":
console.error(bind + " requires elevated privileges.");
process.exit(1);
break;
case "EADDRINUSE":
console.error(bind + " is already in use.");
process.exit(1);
break;
default:
throw error;
}
};
content_copyCOPY
Comments