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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user