mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Added more info when GetSafeNode fails
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user