1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Add debug information for crash on object randomization

This commit is contained in:
Ivan Savenko
2025-01-07 15:06:49 +00:00
parent 2ca77ed6ec
commit ca4227ba9d
3 changed files with 35 additions and 2 deletions

View File

@@ -11,6 +11,7 @@
#include "CRewardableConstructor.h"
#include "../json/JsonUtils.h"
#include "../json/JsonRandom.h"
#include "../mapObjects/CRewardableObject.h"
#include "../texts/CGeneralTextHandler.h"
#include "../IGameCallback.h"
@@ -49,7 +50,14 @@ Rewardable::Configuration CRewardableConstructor::generateConfiguration(IGameCal
{
Rewardable::Configuration result;
result.variables.preset = presetVariables;
objectInfo.configureObject(result, rand, cb);
try {
objectInfo.configureObject(result, rand, cb);
}
catch (const JsonRandomizationException & e)
{
throw std::runtime_error("Failed to generate configuration for object '" + getJsonKey() + "'! Reason: " + e.what());
}
for(auto & rewardInfo : result.info)
{