diff options
author | Hop311 <Hop3114@gmail.com> | 2024-01-18 23:52:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-18 23:52:14 +0100 |
commit | c1bac9acee88a7ce1123aed3a748712fb2441762 (patch) | |
tree | 346cd26d4a74c92cb78c674242703283895aa5f4 /src/openvic-simulation/types/IdentifierRegistry.hpp | |
parent | 75878b11821d8fd78ebdd7b0a11a82970a531616 (diff) | |
parent | e33a330129364b4bd632b2fd531a996b8c57cefb (diff) |
Merge pull request #131 from OpenVicProject/misc-changes
Parse missing variables, Logger counting, misc cleanup
Diffstat (limited to 'src/openvic-simulation/types/IdentifierRegistry.hpp')
-rw-r--r-- | src/openvic-simulation/types/IdentifierRegistry.hpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp index bbaf52c..251632b 100644 --- a/src/openvic-simulation/types/IdentifierRegistry.hpp +++ b/src/openvic-simulation/types/IdentifierRegistry.hpp @@ -232,7 +232,7 @@ namespace OpenVic { } } - constexpr static NodeTools::KeyValueCallback auto key_value_invalid_callback(std::string_view name) { + static constexpr NodeTools::KeyValueCallback auto key_value_invalid_callback(std::string_view name) { return [name](std::string_view key, ast::NodeCPtr) { Logger::error("Invalid ", name, ": ", key); return false; @@ -258,13 +258,7 @@ namespace OpenVic { if (item != nullptr) { \ return callback(*item); \ } \ - if (!warn) { \ - Logger::error("Invalid ", name, ": ", identifier); \ - return false; \ - } else { \ - Logger::warning("Invalid ", name, ": ", identifier); \ - return true; \ - } \ + return NodeTools::warn_or_error(warn, "Invalid ", name, ": ", identifier); \ }; \ } \ constexpr NodeTools::NodeCallback auto expect_item_identifier( \ |