1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Provide more information in thrown exceptions for unfixed crashes

This commit is contained in:
Ivan Savenko
2024-04-22 16:40:43 +03:00
parent 82b921d852
commit 5454d01316
4 changed files with 17 additions and 8 deletions

View File

@ -351,12 +351,12 @@ TObjectTypeHandler CObjectClassesHandler::getHandlerFor(MapObjectID type, MapObj
}
catch (std::out_of_range & e)
{
// Leave catch block silently
// Leave catch block silently and handle error in block outside of try ... catch - all valid values should use 'return' in try block
}
std::string errorString = "Failed to find object of type " + std::to_string(type.getNum()) + "::" + std::to_string(subtype.getNum());
logGlobal->error(errorString);
throw std::runtime_error(errorString);
throw std::out_of_range(errorString);
}
TObjectTypeHandler CObjectClassesHandler::getHandlerFor(const std::string & scope, const std::string & type, const std::string & subtype) const