From 1e8e93232332a4a96b0cd444b70025b320066023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Thu, 30 May 2013 12:14:39 +0000 Subject: [PATCH] Logging around #1237. Typos. --- client/Client.cpp | 11 +++++++++++ lib/CModHandler.cpp | 2 +- lib/VCMI_Lib.cpp | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/client/Client.cpp b/client/Client.cpp index cfd73b295..1160a39bd 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -228,10 +228,16 @@ void CClient::loadGame( const std::string & fname ) sh.startServer(); CStopWatch tmh; + try { auto clientSaveName = CResourceHandler::get()->getResourceName(ResourceID(fname, EResType::CLIENT_SAVEGAME)); auto controlServerSaveName = CResourceHandler::get()->getResourceName(ResourceID(fname, EResType::SERVER_SAVEGAME)); + if(clientSaveName.empty()) + throw std::runtime_error("Cannot open client part of " + fname); + if(controlServerSaveName.empty()) + throw std::runtime_error("Cannot open server part of " + fname); + unique_ptr loader; { CLoadIntegrityValidator checkingLoader(clientSaveName, controlServerSaveName); @@ -248,6 +254,11 @@ void CClient::loadGame( const std::string & fname ) *loader >> *this; logNetwork->infoStream() << "Loaded client part of save " << tmh.getDiff(); } + catch(std::exception &e) + { + logGlobal->errorStream() << "Cannot load game " << fname << ". Error: " << e.what(); + throw; //obviously we cannot continue here + } serv = sh.connectToServer(); serv->addStdVecItems(gs); diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index 0f4950d34..25e0eac2b 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -525,7 +525,7 @@ void CModHandler::loadGameContent() CStopWatch timer, totalTime; CContentHandler content; - logGlobal->infoStream() << "\tInitializing content hander: " << timer.getDiff() << " ms"; + logGlobal->infoStream() << "\tInitializing content handler: " << timer.getDiff() << " ms"; // first - load virtual "core" mod that contains all data // TODO? move all data into real mods? RoE, AB, SoD, WoG diff --git a/lib/VCMI_Lib.cpp b/lib/VCMI_Lib.cpp index 2122aac28..0d080e528 100644 --- a/lib/VCMI_Lib.cpp +++ b/lib/VCMI_Lib.cpp @@ -111,7 +111,7 @@ void LibClasses::init() createHandler(spellh, "Spell", pomtime); - logGlobal->infoStream()<<"\tInitializing handers: "<< totalTime.getDiff(); + logGlobal->infoStream()<<"\tInitializing handlers: "<< totalTime.getDiff(); modh->loadGameContent(); modh->reload();