#ifndef TOOLS__YAML_HPP #define TOOLS__YAML_HPP #include #include "tools/logger.hpp" namespace tools { inline YAML::Node load(const std::string & path) { try { return YAML::LoadFile(path); } catch (const YAML::BadFile & e) { logger()->error("[YAML] Failed to load file: {}", e.what()); exit(1); } catch (const YAML::ParserException & e) { logger()->error("[YAML] Parser error: {}", e.what()); exit(1); } } template inline T read(const YAML::Node & yaml, const std::string & key) { if (yaml[key]) return yaml[key].as(); logger()->error("[YAML] {} not found!", key); exit(1); } } // namespace tools #endif // TOOLS__YAML_HPP