1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Rework handling some errors and uncought exceptions

This commit is contained in:
Michał Zaremba
2025-09-09 15:28:59 +02:00
parent 076f7ba5b5
commit ea261ae48f
20 changed files with 117 additions and 83 deletions

View File

@@ -467,9 +467,19 @@ bool MainWindow::openMap(const QString & filenameSelect)
catch(const ModIncompatibility & e)
{
assert(e.whatExcessive().empty());
QMessageBox::warning(this, tr("Mods are required"), QString::fromStdString(e.whatMissing()));
auto qstrError = QString::fromStdString(e.getFullErrorMsg()).remove('{').remove('}');
QMessageBox::warning(this, tr("Mods are required"), qstrError);
return false;
}
catch(const IdentifierResolutionException & e)
{
MetaString errorMsg;
errorMsg.appendTextID("vcmi.server.errors.campOrMapFile.unknownEntity");
errorMsg.replaceRawString(e.identifierName);
QMessageBox::critical(this, tr("Failed to open map"), QString::fromStdString(errorMsg.toString()));
return false;
}
catch(const std::exception & e)
{
QMessageBox::critical(this, tr("Failed to open map"), tr(e.what()));