Added more info when GetSafeNode fails

This commit is contained in:
KiritoDv
2024-12-03 10:57:13 -06:00
parent 09ade8bb7f
commit ddc7f004a8
+4 -2
View File
@@ -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);
}
}