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

@@ -9,6 +9,9 @@
*/
#pragma once
#include "../lib/texts/CGeneralTextHandler.h"
#include "GameLibrary.h"
VCMI_LIB_NAMESPACE_BEGIN
class DLL_LINKAGE ModIncompatibility: public std::exception
@@ -49,6 +52,22 @@ public:
return messageExcessiveMods;
}
std::string getFullErrorMsg() const noexcept
{
std::string errorMsg;
if(!messageMissingMods.empty())
{
errorMsg += LIBRARY->generaltexth->translate("vcmi.server.errors.modsToEnable") + '\n';
errorMsg += messageMissingMods;
}
if(!messageExcessiveMods.empty())
{
errorMsg += LIBRARY->generaltexth->translate("vcmi.server.errors.modsToDisable") + '\n';
errorMsg += messageExcessiveMods;
}
return errorMsg;
}
private:
std::string messageMissingMods;
std::string messageExcessiveMods;