mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-27 19:37:07 +02:00
MISC: Show user-friendly error message when there is syntax error in scripts (#1963)
This commit is contained in:
@@ -146,7 +146,7 @@ function parseOnlyRamCalculate(
|
||||
const scriptFileType = getFileType(script.filename);
|
||||
let moduleAST;
|
||||
try {
|
||||
moduleAST = parseAST(script.code, scriptFileType);
|
||||
moduleAST = parseAST(script.filename, script.server, script.code, scriptFileType);
|
||||
} catch (error) {
|
||||
return {
|
||||
errorCode: RamCalculationErrorCode.ImportError,
|
||||
@@ -552,7 +552,7 @@ export function calculateRamUsage(
|
||||
): RamCalculation {
|
||||
try {
|
||||
const fileType = getFileType(scriptName);
|
||||
const ast = typeof input === "string" ? parseAST(input, fileType) : input;
|
||||
const ast = typeof input === "string" ? parseAST(scriptName, server, input, fileType) : input;
|
||||
return parseOnlyRamCalculate(ast, scriptName, server, getFileTypeFeature(fileType), otherScripts);
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user