mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
[refactor] Moved "exceptionAlert" to its own TS file
Since this is a UI only function, when Web Workers are introduced this call chain will not be allowed on the backend.
This commit is contained in:
parent
be577164e3
commit
15e3b751da
@ -7,7 +7,8 @@ import {getServer} from "./Server";
|
|||||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {printArray, createElement,
|
import {printArray, createElement,
|
||||||
createAccordionElement, removeElement,
|
createAccordionElement, removeElement,
|
||||||
removeChildrenFromElement, exceptionAlert} from "../utils/HelperFunctions";
|
removeChildrenFromElement} from "../utils/HelperFunctions";
|
||||||
|
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
||||||
import {logBoxCreate} from "../utils/LogBox";
|
import {logBoxCreate} from "../utils/LogBox";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
@ -13,11 +13,12 @@ import {createProgressBarText} from "../utils/helpers/creat
|
|||||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {getRandomInt, addOffset, clearObject,
|
import {getRandomInt, addOffset, clearObject,
|
||||||
createElement, removeChildrenFromElement,
|
createElement, removeChildrenFromElement,
|
||||||
exceptionAlert, createPopup, appendLineBreaks,
|
createPopup, appendLineBreaks,
|
||||||
removeElementById, removeElement} from "../utils/HelperFunctions";
|
removeElementById, removeElement} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
|
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import {Engine} from "./engine";
|
import {Engine} from "./engine";
|
||||||
|
|
||||||
import {removeChildrenFromElement,
|
import {removeChildrenFromElement,
|
||||||
createElement, exceptionAlert} from "../utils/HelperFunctions";
|
createElement} from "../utils/HelperFunctions";
|
||||||
|
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
||||||
import {isString} from "../utils/helpers/isString";
|
import {isString} from "../utils/helpers/isString";
|
||||||
|
|
||||||
var cinematicTextFlag = false;
|
var cinematicTextFlag = false;
|
||||||
|
@ -31,7 +31,8 @@ import {Terminal, postNetburnerText} from "./Terminal";
|
|||||||
import Decimal from "decimal.js";
|
import Decimal from "decimal.js";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {createPopup, createElement,
|
import {createPopup, createElement,
|
||||||
removeElementById, exceptionAlert} from "../utils/HelperFunctions";
|
removeElementById} from "../utils/HelperFunctions";
|
||||||
|
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
||||||
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
||||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {gameOptionsBoxOpen, gameOptionsBoxClose}from "../utils/GameOptions";
|
import {gameOptionsBoxOpen, gameOptionsBoxClose}from "../utils/GameOptions";
|
||||||
import {clearEventListeners, createElement,
|
import {clearEventListeners, createElement,
|
||||||
removeChildrenFromElement,
|
removeChildrenFromElement} from "../utils/HelperFunctions";
|
||||||
exceptionAlert} from "../utils/HelperFunctions";
|
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber,
|
import {formatNumber,
|
||||||
convertTimeMsToTimeElapsedString,
|
convertTimeMsToTimeElapsedString,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
//General helper functions
|
//General helper functions
|
||||||
import {isString} from "./helpers/isString";
|
import {isString} from "./helpers/isString";
|
||||||
import {dialogBoxCreate} from "./DialogBox";
|
|
||||||
|
|
||||||
//Returns the size (number of keys) of an object
|
//Returns the size (number of keys) of an object
|
||||||
function sizeOfObject(obj) {
|
function sizeOfObject(obj) {
|
||||||
@ -248,16 +247,6 @@ function roundToTwo(n) {
|
|||||||
return +(Math.round(n + "e+2") + "e-2");
|
return +(Math.round(n + "e+2") + "e-2");
|
||||||
}
|
}
|
||||||
|
|
||||||
function exceptionAlert(e) {
|
|
||||||
dialogBoxCreate("Caught an exception: " + e + "<br><br>" +
|
|
||||||
"Filename: " + e.fileName + "<br><br>" +
|
|
||||||
"Line Number: " + e.lineNumber + "<br><br>" +
|
|
||||||
"This is a bug, please report to game developer with this " +
|
|
||||||
"message as well as details about how to reproduce the bug.<br><br>" +
|
|
||||||
"If you want to be safe, I suggest refreshing the game WITHOUT saving so that your " +
|
|
||||||
"safe doesn't get corrupted");
|
|
||||||
}
|
|
||||||
|
|
||||||
export {sizeOfObject,
|
export {sizeOfObject,
|
||||||
clearObject,
|
clearObject,
|
||||||
addOffset,
|
addOffset,
|
||||||
@ -276,5 +265,4 @@ export {sizeOfObject,
|
|||||||
removeChildrenFromElement,
|
removeChildrenFromElement,
|
||||||
createPopup,
|
createPopup,
|
||||||
clearSelector,
|
clearSelector,
|
||||||
exceptionAlert,
|
|
||||||
getElementById};
|
getElementById};
|
||||||
|
16
utils/helpers/exceptionAlert.js
Normal file
16
utils/helpers/exceptionAlert.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { dialogBoxCreate } from "../DialogBox";
|
||||||
|
|
||||||
|
function exceptionAlert(e) {
|
||||||
|
dialogBoxCreate("Caught an exception: " + e + "<br><br>" +
|
||||||
|
"Filename: " + (e.fileName || "UNKNOWN FILE NAME") + "<br><br>" +
|
||||||
|
"Line Number: " + (e.lineNumber || "UNKNOWN LINE NUMBER") + "<br><br>" +
|
||||||
|
"This is a bug, please report to game developer with this " +
|
||||||
|
"message as well as details about how to reproduce the bug.<br><br>" +
|
||||||
|
"If you want to be safe, I suggest refreshing the game WITHOUT saving so that your " +
|
||||||
|
"safe doesn't get corrupted");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export {
|
||||||
|
exceptionAlert
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user