Sfoglia il codice sorgente

More meaningful exception messages

Ivan Savenko 1 anno fa
parent
commit
364977ef40

+ 1 - 1
lib/IHandlerBase.h

@@ -116,7 +116,7 @@ public:
 		if(index < 0 || index >= objects.size())
 		{
 			logMod->error("%s id %d is invalid", getTypeNames()[0], index);
-			throw std::runtime_error("internal error");
+			throw std::runtime_error("Attempt to access invalid index " + std::to_string(index) + " of type " + getTypeNames().front());
 		}
 
 		return objects[index];

+ 1 - 1
lib/mapObjects/CGTownInstance.cpp

@@ -1079,7 +1079,7 @@ void CGTownInstance::addHeroToStructureVisitors(const CGHeroInstance *h, si64 st
 	{
 		//should never ever happen
 		logGlobal->error("Cannot add hero %s to visitors of structure # %d", h->getNameTranslated(), structureInstanceID);
-		throw std::runtime_error("internal error");
+		throw std::runtime_error("unexpected hero in CGTownInstance::addHeroToStructureVisitors");
 	}
 }
 

+ 1 - 1
lib/mapObjects/MiscObjects.cpp

@@ -1239,7 +1239,7 @@ void CGObelisk::setPropertyDer(ObjProperty what, ObjPropertyID identifier)
 				if(progress > obeliskCount)
 				{
 					logGlobal->error("Visited %d of %d", static_cast<int>(progress), obeliskCount);
-					throw std::runtime_error("internal error");
+					throw std::runtime_error("Player visited more obelisks than present on map!");
 				}
 
 				break;