Show exception message in profile saving

This commit is contained in:
Eidolon 2024-04-27 19:27:00 -05:00
parent ed2036432b
commit bc524cd0e9
2 changed files with 7 additions and 1 deletions

View file

@ -13,6 +13,7 @@
#include <algorithm> #include <algorithm>
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
#include <exception>
#include <filesystem> #include <filesystem>
#include <fmt/format.h> #include <fmt/format.h>
@ -304,7 +305,7 @@ void srb2::save_ng_gamedata()
srb2::io::write_exact(file, tcb::as_bytes(tcb::make_span(ubjson))); srb2::io::write_exact(file, tcb::as_bytes(tcb::make_span(ubjson)));
file.close(); file.close();
} }
catch (const srb2::io::FileStreamException& ex) catch (const std::exception& ex)
{ {
CONS_Alert(CONS_ERROR, "NG Gamedata save failed: %s\n", ex.what()); CONS_Alert(CONS_ERROR, "NG Gamedata save failed: %s\n", ex.what());
} }

View file

@ -12,6 +12,7 @@
/// \brief implements methods for profiles etc. /// \brief implements methods for profiles etc.
#include <algorithm> #include <algorithm>
#include <exception>
#include <fmt/format.h> #include <fmt/format.h>
@ -332,6 +333,10 @@ void PR_SaveProfiles(void)
fs::rename(tmppath, realpath); fs::rename(tmppath, realpath);
} }
catch (const std::exception& ex)
{
I_Error("Couldn't save profiles. Are you out of Disk space / playing in a protected folder?\n\nException: %s", ex.what());
}
catch (...) catch (...)
{ {
I_Error("Couldn't save profiles. Are you out of Disk space / playing in a protected folder?"); I_Error("Couldn't save profiles. Are you out of Disk space / playing in a protected folder?");