mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-29 20:37:05 +02:00
MISC: Handle error when getting save data (#1241)
This commit is contained in:
@@ -39,6 +39,7 @@ import { useBoolean } from "../hooks";
|
||||
|
||||
import { ComparisonIcon } from "./ComparisonIcon";
|
||||
import { SaveData } from "../../../types";
|
||||
import { handleGetSaveDataError } from "../../../Netscript/ErrorMessages";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -131,7 +132,16 @@ export const ImportSave = (props: { saveData: SaveData; automatic: boolean }): J
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (props.saveData) fetchData();
|
||||
if (props.saveData) {
|
||||
fetchData().catch((error) => {
|
||||
handleGoBack();
|
||||
// We cannot show dialog box in this screen (due to "withPopups = false"), so we will try showing it with a
|
||||
// delay. 1 second is usually enough to go back to other normal screens that allow showing popups.
|
||||
setTimeout(() => {
|
||||
handleGetSaveDataError(error);
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
}, [props.saveData]);
|
||||
|
||||
if (!importData || !currentData) return <></>;
|
||||
|
||||
Reference in New Issue
Block a user