Skip to content

Commit

Permalink
Added more info when GetSafeNode fails
Browse files Browse the repository at this point in the history
  • Loading branch information
KiritoDv committed Dec 3, 2024
1 parent 09ade8b commit ddc7f00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/factories/BaseFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit ddc7f00

Please sign in to comment.