Add exception messages to data load I_Errors

This commit is contained in:
Eidolon 2024-04-27 18:25:59 -05:00
parent d90a566ad7
commit 723546a56b
2 changed files with 13 additions and 1 deletions

View file

@ -434,6 +434,13 @@ void srb2::load_ng_gamedata()
json parsed = json::from_ubjson(remainder_as_u8);
js = parsed.template get<GamedataJson>();
}
catch (const std::exception& ex)
{
const char* gdfolder = G_GameDataFolder();
const char* what = ex.what();
I_Error("Game data is corrupt.\nDelete %s (maybe in %s) and try again.\n\nException: %s", gamedatafilename, gdfolder, what);
return;
}
catch (...)
{
const char* gdfolder = G_GameDataFolder();

View file

@ -398,9 +398,14 @@ void PR_LoadProfiles(void)
json parsed = json::from_ubjson(remainder_as_u8);
js = parsed.template get<ProfilesJson>();
}
catch (const std::exception& ex)
{
I_Error("Profiles file is corrupt.\n\nException: %s", ex.what());
return;
}
catch (...)
{
I_Error("Profiles file is corrupt");
I_Error("Profiles file is corrupt.");
return;
}