mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
Try to make an error message more helpful
This commit is contained in:
parent
1ff7f4bcd4
commit
faad0ae8a7
36
dist/vendor.bundle.js
vendored
36
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -49,12 +49,9 @@
|
|||||||
display: none; /* for Chrome, Safari, and Opera */
|
display: none; /* for Chrome, Safari, and Opera */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link rel="shortcut icon" href="favicon.ico" />
|
<link rel="shortcut icon" href="favicon.ico"></head>
|
||||||
</head>
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root"/>
|
<div id="root"/>
|
||||||
<script type="text/javascript" src="dist/vendor.bundle.js"></script>
|
<script type="text/javascript" src="dist/vendor.bundle.js"></script><script type="text/javascript" src="main.bundle.js"></script></body>
|
||||||
<script type="text/javascript" src="main.bundle.js"></script>
|
|
||||||
</body>
|
|
||||||
<!-- http://plaza.dsolver.ca/m/hydroflame4418 -->
|
<!-- http://plaza.dsolver.ca/m/hydroflame4418 -->
|
||||||
</html>
|
</html>
|
||||||
|
59387
main.bundle.js
59387
main.bundle.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -13,13 +13,12 @@ export function netscriptDelay(time: number, workerScript: WorkerScript): Promis
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function makeRuntimeRejectMsg(workerScript: WorkerScript, msg: string): string {
|
export function makeRuntimeRejectMsg(workerScript: WorkerScript, msg: string): string {
|
||||||
const lineNum = "";
|
|
||||||
const server = GetServer(workerScript.hostname);
|
const server = GetServer(workerScript.hostname);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
throw new Error(`WorkerScript constructed with invalid server ip: ${workerScript.hostname}`);
|
throw new Error(`WorkerScript constructed with invalid server ip: ${workerScript.hostname}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "|" + server.hostname + "|" + workerScript.name + "|" + msg + lineNum;
|
return "|" + server.hostname + "|" + workerScript.name + "|" + msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveNetscriptRequestedThreads(
|
export function resolveNetscriptRequestedThreads(
|
||||||
|
@ -124,10 +124,14 @@ function startNetscript2Script(workerScript: WorkerScript): Promise<WorkerScript
|
|||||||
.catch((e) => reject(e));
|
.catch((e) => reject(e));
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
|
if (e instanceof SyntaxError) {
|
||||||
|
workerScript.errorMessage = makeRuntimeRejectMsg(workerScript, e.message + " (sorry we can't be more helpful)");
|
||||||
|
} else {
|
||||||
workerScript.errorMessage = makeRuntimeRejectMsg(
|
workerScript.errorMessage = makeRuntimeRejectMsg(
|
||||||
workerScript,
|
workerScript,
|
||||||
e.message + ((e.stack && "\nstack:\n" + e.stack.toString()) || ""),
|
e.message + ((e.stack && "\nstack:\n" + e.stack.toString()) || ""),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
throw workerScript;
|
throw workerScript;
|
||||||
} else if (isScriptErrorMessage(e)) {
|
} else if (isScriptErrorMessage(e)) {
|
||||||
workerScript.errorMessage = e;
|
workerScript.errorMessage = e;
|
||||||
|
@ -177,7 +177,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
for (let i = 0; i < server.scripts.length; i++) {
|
for (let i = 0; i < server.scripts.length; i++) {
|
||||||
if (filename == server.scripts[i].filename) {
|
if (filename == server.scripts[i].filename) {
|
||||||
server.scripts[i].saveScript(filename, code, props.player.currentServer, server.scripts);
|
server.scripts[i].saveScript(filename, code, props.player.currentServer, server.scripts);
|
||||||
saveObject.saveGame();
|
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
||||||
props.router.toTerminal();
|
props.router.toTerminal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
for (let i = 0; i < server.textFiles.length; ++i) {
|
for (let i = 0; i < server.textFiles.length; ++i) {
|
||||||
if (server.textFiles[i].fn === filename) {
|
if (server.textFiles[i].fn === filename) {
|
||||||
server.textFiles[i].write(code);
|
server.textFiles[i].write(code);
|
||||||
saveObject.saveGame();
|
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
||||||
props.router.toTerminal();
|
props.router.toTerminal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveObject.saveGame();
|
if (Settings.SaveGameOnFileSave) saveObject.saveGame();
|
||||||
props.router.toTerminal();
|
props.router.toTerminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user