From ddc7f004a8580be030942dded68008a4e9af3a9d Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Tue, 3 Dec 2024 10:57:13 -0600 Subject: [PATCH] Added more info when GetSafeNode fails --- src/factories/BaseFactory.h | 6 ++++-- 1 file 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 GetNode(YAML::Node& node, const std::string& key) { template 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() + "'"); + throw std::runtime_error("Yaml asset missing the '" + key + "' node for '" + node["symbol"].as() + "'\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); } }