forked from svrjs/svrjs
Improve server error handling for Bun.
This commit is contained in:
parent
61dead9b4a
commit
f0193b5933
1 changed files with 88 additions and 104 deletions
16
svr.js
16
svr.js
|
@ -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 () {
|
||||
|
|
Reference in a new issue