error catching

This commit is contained in:
ReznoRMichael 2021-02-18 02:59:36 +01:00
parent c51f9484bf
commit cc74ee936f
2 changed files with 8 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -96,7 +96,12 @@ function ProcessFileObject() {
console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin);
// 4. Analyze the decoded string immediately
HKCheckCompletion(JSON.parse(decodedString));
try {
HKCheckCompletion(JSON.parse(decodedString));
} catch (error) {
alert(`This seems like not a valid Hollow Knight save. ${error}`);
console.info(`This seems like not a valid Hollow Knight save. ${error}`);
}
// 5. Paste decoded string file to text area
document.getElementById("save-area").value = "";