diff --git a/config/translate.json b/config/translate.json index ba797d4d9..9d12a600b 100644 --- a/config/translate.json +++ b/config/translate.json @@ -31,7 +31,8 @@ { "errors" : { - "existingProcess" : "Another vcmiserver process is running, please terminate it first" + "existingProcess" : "Another vcmiserver process is running, please terminate it first", + "modsIncompatibility" : "Mods are required to load game:" } }, "systemOptions" : diff --git a/lib/CModHandler.h b/lib/CModHandler.h index 8b1f5ad02..d951334d8 100644 --- a/lib/CModHandler.h +++ b/lib/CModHandler.h @@ -276,18 +276,16 @@ class DLL_LINKAGE CModHandler void loadOneMod(std::string modName, std::string parent, const JsonNode & modSettings, bool enableMods); public: - class DLL_LINKAGE Incompatibility: public std::logic_error + class DLL_LINKAGE Incompatibility: public std::exception { public: using StringPair = std::pair; using ModList = std::list; Incompatibility(ModList && _missingMods): - std::logic_error("Mods are required to load game"), missingMods(std::move(_missingMods)) { std::ostringstream _ss; - _ss << std::logic_error::what() << std::endl; for(auto & m : missingMods) _ss << m.first << ' ' << m.second << std::endl; message = _ss.str(); diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 8e9641135..86f2c7175 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -2987,7 +2987,9 @@ bool CGameHandler::load(const std::string & filename) catch(const CModHandler::Incompatibility & e) { logGlobal->error("Failed to load game: %s", e.what()); - lobby->announceMessage(e.what()); + auto errorMsg = VLC->generaltexth->localizedTexts["server"]["errors"]["modsIncompatibility"].String() + '\n'; + errorMsg += e.what(); + lobby->announceMessage(errorMsg); return false; } catch(const std::exception & e)