Changed: Exceptions catched by reference

This commit is contained in:
kervala 2011-06-03 10:42:40 +02:00
parent 7c27c233eb
commit 7a081ca8b5
3 changed files with 16 additions and 16 deletions

View file

@ -168,7 +168,7 @@ void impulseDatabaseInitPlayer(NLMISC::CBitMemStream &impulse)
IngameDbMngr.setInitPacketReceived(); IngameDbMngr.setInitPacketReceived();
nlinfo( "DB_INIT:PLR done (%u bytes)", impulse.getPos()-p ); nlinfo( "DB_INIT:PLR done (%u bytes)", impulse.getPos()-p );
} }
catch (Exception &e) catch (const Exception &e)
{ {
BOMB( NLMISC::toString( "Problem while decoding a DB_INIT:PLR msg, skipped: %s", e.what() ), return ); BOMB( NLMISC::toString( "Problem while decoding a DB_INIT:PLR msg, skipped: %s", e.what() ), return );
} }
@ -185,7 +185,7 @@ void impulseDatabaseUpdatePlayer(NLMISC::CBitMemStream &impulse)
// read delta // read delta
IngameDbMngr.readDelta( serverTick, impulse, CDBPlayer ); // unlike on the server, here there is only one unified CCDBSynchronized object IngameDbMngr.readDelta( serverTick, impulse, CDBPlayer ); // unlike on the server, here there is only one unified CCDBSynchronized object
} }
catch (Exception &e) catch (const Exception &e)
{ {
BOMB( NLMISC::toString( "Problem while decoding a DB_UPDATE_PLR msg, skipped: %s", e.what() ), return ); BOMB( NLMISC::toString( "Problem while decoding a DB_UPDATE_PLR msg, skipped: %s", e.what() ), return );
@ -218,7 +218,7 @@ void impulseDatabaseUpdateBank(NLMISC::CBitMemStream &impulse)
updateInventoryFromStream( impulse, (INVENTORIES::CInventoryCategoryForGuild*)NULL, false ); updateInventoryFromStream( impulse, (INVENTORIES::CInventoryCategoryForGuild*)NULL, false );
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:UPDATE_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return ); BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:UPDATE_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return );
} }
@ -248,7 +248,7 @@ void impulseDatabaseInitBank(NLMISC::CBitMemStream &impulse)
updateInventoryFromStream( impulse, (INVENTORIES::CInventoryCategoryForGuild*)NULL, false ); updateInventoryFromStream( impulse, (INVENTORIES::CInventoryCategoryForGuild*)NULL, false );
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:INIT_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return ); BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:INIT_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return );
} }
@ -272,7 +272,7 @@ void impulseDatabaseResetBank(NLMISC::CBitMemStream &impulse)
IngameDbMngr.getNodePtr()->resetBank( serverTick, (TCDBBank)bank ); IngameDbMngr.getNodePtr()->resetBank( serverTick, (TCDBBank)bank );
nldebug( "CDB: DB_GROUP:RESET_BANK %s", CDBBankNames[bank] ); nldebug( "CDB: DB_GROUP:RESET_BANK %s", CDBBankNames[bank] );
} }
catch (Exception &e) catch (const Exception &e)
{ {
BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:RESET_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return ); BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:RESET_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return );
} }
@ -1568,7 +1568,7 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason)
} }
} }
catch (EStream &) catch (const EStream &)
{ {
tpReason = ucstring("TP Reason"); tpReason = ucstring("TP Reason");
tpCancelText = ucstring("Cancel TP"); // for test tpCancelText = ucstring("Cancel TP"); // for test
@ -2236,7 +2236,7 @@ void impulseCounter(NLMISC::CBitMemStream &impulse)
} }
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
nlwarning ("Problem while decoding a COUTNER msg, skipped: %s", e.what()); nlwarning ("Problem while decoding a COUTNER msg, skipped: %s", e.what());
} }

View file

@ -96,7 +96,7 @@ CFightScriptComp *CFightSelectFilterReader::create (const std::string &inStr) th
{ {
scriptComp=createScriptComp(params[1]); scriptComp=createScriptComp(params[1]);
} }
catch (ReadFightActionException &ex) catch (const ReadFightActionException &ex)
{ {
throw ReadFightActionException("cannot create sub ScriptComp : "+std::string(ex.what())); throw ReadFightActionException("cannot create sub ScriptComp : "+std::string(ex.what()));
} }
@ -164,7 +164,7 @@ public:
{ {
scriptComp=createScriptComp(params[0]); scriptComp=createScriptComp(params[0]);
} }
catch (ReadFightActionException &ex) catch (const ReadFightActionException &ex)
{ {
throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what())); throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what()));
} }
@ -244,7 +244,7 @@ public:
{ {
scriptComp=createScriptComp(params[1]); scriptComp=createScriptComp(params[1]);
} }
catch (ReadFightActionException &ex) catch (const ReadFightActionException &ex)
{ {
throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what())); throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what()));
} }
@ -315,7 +315,7 @@ public:
{ {
scriptComp=createScriptComp(params[1]); scriptComp=createScriptComp(params[1]);
} }
catch (ReadFightActionException &ex) catch (const ReadFightActionException &ex)
{ {
throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what())); throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what()));
} }
@ -385,7 +385,7 @@ public:
{ {
scriptComp=createScriptComp(params[1]); scriptComp=createScriptComp(params[1]);
} }
catch (ReadFightActionException &ex) catch (const ReadFightActionException &ex)
{ {
throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what())); throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what()));
} }
@ -456,7 +456,7 @@ public:
{ {
scriptComp=createScriptComp(params[1]); scriptComp=createScriptComp(params[1]);
} }
catch (ReadFightActionException &ex) catch (const ReadFightActionException &ex)
{ {
throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what())); throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what()));
} }
@ -1012,7 +1012,7 @@ public:
for (uint32 i=0;i<nbSubScript;i++) for (uint32 i=0;i<nbSubScript;i++)
scriptComps.push_back(createScriptComp(params[i])); scriptComps.push_back(createScriptComp(params[i]));
} }
catch (ReadFightActionException &ex) catch (const ReadFightActionException &ex)
{ {
throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what())); throw ReadFightActionException("cannot create sub ScriptComp : "+string(ex.what()));
} }
@ -1085,7 +1085,7 @@ CFightScriptComp *CFightScriptCompReader::createScriptComp (const string &str) t
{ {
return getScriptReader (scriptCompName)->create(str); return getScriptReader (scriptCompName)->create(str);
} }
catch (ReadFightActionException &e) catch (const ReadFightActionException &e)
{ {
throw ReadFightActionException(string("ScriptComp creation failed : ")+string(e.what())); throw ReadFightActionException(string("ScriptComp creation failed : ")+string(e.what()));
} }

View file

@ -1825,7 +1825,7 @@ bool execLoadScript(CStringWriter& stringWriter, vector<string> const& args)
FOREACHC(itGrp, vector<CGroup*>, grps) FOREACHC(itGrp, vector<CGroup*>, grps)
(*itGrp)->getPersistentStateInstance()->interpretCode(NULL, codePtr); (*itGrp)->getPersistentStateInstance()->interpretCode(NULL, codePtr);
} }
catch (const EPathNotFound &e) catch (const EPathNotFound &)
{ {
nlwarning("Path not found while loading AIS script %s", args[2].c_str()); nlwarning("Path not found while loading AIS script %s", args[2].c_str());
return false; return false;