This commit is contained in:
Olivier Gagnon 2022-04-11 21:45:55 -04:00
parent a17b81dff3
commit a11e2868df

@ -575,7 +575,8 @@ function createAndAddWorkerScript(
// Once the code finishes (either resolved or rejected, doesnt matter), set its
// running status to false
scriptExecution.then(function () {
scriptExecution
.then(function () {
workerScript.running = false;
workerScript.env.stopFlag = true;
// On natural death, the earnings are transfered to the parent if it still exists.
@ -588,7 +589,8 @@ function createAndAddWorkerScript(
killWorkerScript(workerScript);
workerScript.log("", () => "Script finished running");
}).catch(function (e) {
})
.catch(function (e) {
if (e instanceof Error) {
dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer");
console.error("Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: " + e.toString());