diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-12-03 10:57:13 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2024-12-03 10:57:13 -0600 |
| commit | ddc7f004a8580be030942dded68008a4e9af3a9d (patch) | |
| tree | d120729992e7caa51720af9045cd7ad0f350f889 /src | |
| parent | 09ade8bb7fc85f35dcabb2def2e2694f29739765 (diff) | |
Added more info when GetSafeNode fails
Diffstat (limited to 'src')
| -rw-r--r-- | src/factories/BaseFactory.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/factories/BaseFactory.h b/src/factories/BaseFactory.h index 0320605..b8cecc6 100644 --- a/src/factories/BaseFactory.h +++ b/src/factories/BaseFactory.h @@ -52,10 +52,12 @@ std::optional<T> GetNode(YAML::Node& node, const std::string& key) { template<typename T> T GetSafeNode(YAML::Node& node, const std::string& key) { if(!node[key]) { + auto dump = YAML::Dump(node); + if (node["symbol"]) { - throw std::runtime_error("Yaml asset missing the '" + key + "' node for '" + node["symbol"].as<std::string>() + "'"); + throw std::runtime_error("Yaml asset missing the '" + key + "' node for '" + node["symbol"].as<std::string>() + "'\nProblematic YAML:\n" + dump); } else { - throw std::runtime_error("Yaml asset missing the '" + key + "' node"); + throw std::runtime_error("Yaml asset missing the '" + key + "' node\nProblematic YAML:\n" + dump); } } |
