mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-02 03:17:34 +01:00
fmt
This commit is contained in:
parent
a17b81dff3
commit
a11e2868df
@ -575,63 +575,65 @@ function createAndAddWorkerScript(
|
|||||||
|
|
||||||
// Once the code finishes (either resolved or rejected, doesnt matter), set its
|
// Once the code finishes (either resolved or rejected, doesnt matter), set its
|
||||||
// running status to false
|
// running status to false
|
||||||
scriptExecution.then(function () {
|
scriptExecution
|
||||||
workerScript.running = false;
|
.then(function () {
|
||||||
workerScript.env.stopFlag = true;
|
workerScript.running = false;
|
||||||
// On natural death, the earnings are transfered to the parent if it still exists.
|
workerScript.env.stopFlag = true;
|
||||||
if (parent !== undefined) {
|
// On natural death, the earnings are transfered to the parent if it still exists.
|
||||||
if (parent.running) {
|
if (parent !== undefined) {
|
||||||
parent.scriptRef.onlineExpGained += runningScriptObj.onlineExpGained;
|
if (parent.running) {
|
||||||
parent.scriptRef.onlineMoneyMade += runningScriptObj.onlineMoneyMade;
|
parent.scriptRef.onlineExpGained += runningScriptObj.onlineExpGained;
|
||||||
|
parent.scriptRef.onlineMoneyMade += runningScriptObj.onlineMoneyMade;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
killWorkerScript(workerScript);
|
killWorkerScript(workerScript);
|
||||||
workerScript.log("", () => "Script finished running");
|
workerScript.log("", () => "Script finished running");
|
||||||
}).catch(function (e) {
|
})
|
||||||
if (e instanceof Error) {
|
.catch(function (e) {
|
||||||
dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer");
|
if (e instanceof Error) {
|
||||||
console.error("Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: " + e.toString());
|
dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer");
|
||||||
return;
|
console.error("Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: " + e.toString());
|
||||||
} else if (e instanceof ScriptDeath) {
|
return;
|
||||||
if (isScriptErrorMessage(workerScript.errorMessage)) {
|
} else if (e instanceof ScriptDeath) {
|
||||||
const errorTextArray = workerScript.errorMessage.split("|DELIMITER|");
|
if (isScriptErrorMessage(workerScript.errorMessage)) {
|
||||||
if (errorTextArray.length != 4) {
|
const errorTextArray = workerScript.errorMessage.split("|DELIMITER|");
|
||||||
console.error("ERROR: Something wrong with Error text in evaluator...");
|
if (errorTextArray.length != 4) {
|
||||||
console.error("Error text: " + workerScript.errorMessage);
|
console.error("ERROR: Something wrong with Error text in evaluator...");
|
||||||
return;
|
console.error("Error text: " + workerScript.errorMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const hostname = errorTextArray[1];
|
||||||
|
const scriptName = errorTextArray[2];
|
||||||
|
const errorMsg = errorTextArray[3];
|
||||||
|
|
||||||
|
let msg = `RUNTIME ERROR<br>${scriptName}@${hostname} (PID - ${workerScript.pid})<br>`;
|
||||||
|
if (workerScript.args.length > 0) {
|
||||||
|
msg += `Args: ${arrayToString(workerScript.args)}<br>`;
|
||||||
|
}
|
||||||
|
msg += "<br>";
|
||||||
|
msg += errorMsg;
|
||||||
|
|
||||||
|
dialogBoxCreate(msg);
|
||||||
|
workerScript.log("", () => "Script crashed with runtime error");
|
||||||
|
} else {
|
||||||
|
workerScript.log("", () => "Script killed");
|
||||||
|
return; // Already killed, so stop here
|
||||||
}
|
}
|
||||||
const hostname = errorTextArray[1];
|
} else if (isScriptErrorMessage(e)) {
|
||||||
const scriptName = errorTextArray[2];
|
dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer");
|
||||||
const errorMsg = errorTextArray[3];
|
console.error(
|
||||||
|
"ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN: " +
|
||||||
let msg = `RUNTIME ERROR<br>${scriptName}@${hostname} (PID - ${workerScript.pid})<br>`;
|
e.toString(),
|
||||||
if (workerScript.args.length > 0) {
|
);
|
||||||
msg += `Args: ${arrayToString(workerScript.args)}<br>`;
|
return;
|
||||||
}
|
|
||||||
msg += "<br>";
|
|
||||||
msg += errorMsg;
|
|
||||||
|
|
||||||
dialogBoxCreate(msg);
|
|
||||||
workerScript.log("", () => "Script crashed with runtime error");
|
|
||||||
} else {
|
} else {
|
||||||
workerScript.log("", () => "Script killed");
|
dialogBoxCreate("An unknown script died for an unknown reason. This is a bug please contact game dev");
|
||||||
return; // Already killed, so stop here
|
console.error(e);
|
||||||
}
|
}
|
||||||
} else if (isScriptErrorMessage(e)) {
|
|
||||||
dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer");
|
|
||||||
console.error(
|
|
||||||
"ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN: " +
|
|
||||||
e.toString(),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
dialogBoxCreate("An unknown script died for an unknown reason. This is a bug please contact game dev");
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
killWorkerScript(workerScript);
|
killWorkerScript(workerScript);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user