Implement exception message box popups (#1104)

This commit is contained in:
rdrdrdrd95 2021-08-20 07:53:10 -05:00 committed by GitHub
parent 7d0f7f9dba
commit ce8f6bca9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
21.08+ (???)
------------------------------------------------------------------------
- Fix: [#1108] Road selection not being remembered.
- Change: [#1104] Exceptions now trigger a message box popup, instead of only being written to the console.
21.08 (2021-08-12)
------------------------------------------------------------------------

View File

@ -202,6 +202,7 @@ namespace OpenLoco::Environment
catch (const std::exception& e)
{
std::fprintf(stderr, "Unable to create directory: %s\n", e.what());
Ui::showMessageBox("Unable to create directory", e.what());
}
}

View File

@ -4,6 +4,7 @@
#include "../Environment.h"
#include "../Interop/Interop.hpp"
#include "../Platform/Platform.h"
#include "../Ui.h"
#include "../Utility/Yaml.hpp"
#include "Conversion.h"
#include "StringIds.h"
@ -258,6 +259,7 @@ namespace OpenLoco::Localisation
catch (const std::exception& e)
{
std::cerr << e.what() << "\n";
Ui::showMessageBox("Exception", e.what());
return false;
}
}

View File

@ -330,6 +330,7 @@ namespace OpenLoco::Map::TileManager
}
catch (const std::bad_alloc&)
{
Ui::showMessageBox("Bad Alloc", "Bad memory allocation, exiting");
exitWithError(4370, StringIds::null);
return;
}

View File

@ -1189,9 +1189,10 @@ namespace OpenLoco
// TODO extra clean up code
}
}
catch (const std::exception& ex)
catch (const std::exception& e)
{
std::cerr << ex.what() << std::endl;
std::cerr << e.what() << std::endl;
Ui::showMessageBox("Exception", e.what());
}
}
}