mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-29 12:27:07 +02:00
Initial commit
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import * as walk from "acorn-walk";
|
||||
import { parse } from "acorn";
|
||||
|
||||
import { makeRuntimeRejectMsg } from "./NetscriptEvaluator";
|
||||
import { helpers } from "./Netscript/NetscriptHelpers";
|
||||
import { ScriptUrl } from "./Script/ScriptUrl";
|
||||
import { WorkerScript } from "./Netscript/WorkerScript";
|
||||
import { Script } from "./Script/Script";
|
||||
@@ -74,18 +74,18 @@ export async function executeJSScript(
|
||||
const ns = workerScript.env.vars;
|
||||
|
||||
if (!loadedModule) {
|
||||
throw makeRuntimeRejectMsg(workerScript, `${script.filename} cannot be run because the script module won't load`);
|
||||
throw helpers.makeRuntimeRejectMsg(workerScript, `${script.filename} cannot be run because the script module won't load`);
|
||||
}
|
||||
// TODO: putting await in a non-async function yields unhelpful
|
||||
// "SyntaxError: unexpected reserved word" with no line number information.
|
||||
if (!loadedModule.main) {
|
||||
throw makeRuntimeRejectMsg(
|
||||
throw helpers.makeRuntimeRejectMsg(
|
||||
workerScript,
|
||||
`${script.filename} cannot be run because it does not have a main function.`,
|
||||
);
|
||||
}
|
||||
if (!ns) {
|
||||
throw makeRuntimeRejectMsg(
|
||||
throw helpers.makeRuntimeRejectMsg(
|
||||
workerScript,
|
||||
`${script.filename} cannot be run because the NS object hasn't been constructed properly.`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user