1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-08 23:22:25 +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

@@ -569,24 +569,14 @@ bool CServerHandler::validateGameStart(bool allowOnlyAI) const
catch(ModIncompatibility & e)
{
logGlobal->warn("Incompatibility exception during start scenario: %s", e.what());
std::string errorMsg;
if(!e.whatMissing().empty())
{
errorMsg += LIBRARY->generaltexth->translate("vcmi.server.errors.modsToEnable") + '\n';
errorMsg += e.whatMissing();
}
if(!e.whatExcessive().empty())
{
errorMsg += LIBRARY->generaltexth->translate("vcmi.server.errors.modsToDisable") + '\n';
errorMsg += e.whatExcessive();
}
showServerError(errorMsg);
showServerError(e.getFullErrorMsg());
return false;
}
catch(std::exception & e)
{
logGlobal->error("Exception during startScenario: %s", e.what());
showServerError( std::string("Unable to start map! Reason: ") + e.what());
showServerError(std::string("Unable to start map!\nReason: ") + e.what());
return false;
}