1
0
Fork 0
forked from svrjs/svrjs

Improve server error handling for Bun.

This commit is contained in:
Dorian Niemiec 2023-08-12 12:47:48 +02:00
parent 61dead9b4a
commit f0193b5933

16
svr.js
View file

@ -1778,7 +1778,6 @@ if (!cluster.isPrimary) {
}
server2.on("error", function (err) {
if (err.code == "EADDRINUSE" || err.code == "EADDRNOTAVAIL" || err.code == "EACCES") {
attmtsRedir--;
if (cluster.isPrimary === undefined) {
if (err.code == "EADDRINUSE") {
@ -1827,13 +1826,6 @@ if (!cluster.isPrimary) {
if (cluster.isPrimary !== undefined) process.send("\x12" + err.code);
process.exit(errors[err.code]);
}
} else {
serverconsole.locerrmessage("There was a problem starting SVR.JS!!!");
serverconsole.locerrmessage("Stack:");
serverconsole.locerrmessage(generateErrorStack(err));
if (cluster.isPrimary !== undefined) process.send("\x12CRASH");
process.exit(err.code ? errors[err.code] : 1);
}
});
server2.on("listening", function () {
@ -4531,7 +4523,6 @@ if (!cluster.isPrimary) {
}
//Listen port to server
server.on("error", function (err) {
if (err.code == "EADDRINUSE" || err.code == "EADDRNOTAVAIL" || err.code == "EACCES") {
attmts--;
if (cluster.isPrimary === undefined) {
if (err.code == "EADDRINUSE") {
@ -4580,13 +4571,6 @@ if (!cluster.isPrimary) {
if (cluster.isPrimary !== undefined) process.send("\x12" + err.code);
process.exit(errors[err.code]);
}
} else {
serverconsole.locerrmessage("There was a problem starting SVR.JS!!!");
serverconsole.locerrmessage("Stack:");
serverconsole.locerrmessage(generateErrorStack(err));
if (cluster.isPrimary !== undefined) process.send("\x12CRASH");
process.exit(err.code ? errors[err.code] : 1);
}
});
server.on("listening", function () {