commit | 6971025c643ab32c7280bc353a6e33c497b256c8 | [log] [tgz] |
---|---|---|
author | Václav Kubernát <kubernat@cesnet.cz> | Fri Nov 15 17:08:30 2019 +0100 |
committer | Jan Kundrát <kundrat@cesnet.cz> | Mon Nov 18 12:10:51 2019 +0100 |
tree | 2112f211897247ae5fea9eb9ae1b53147d77e08b | |
parent | 1ce4b32b8f89cc512182d433d432981415af9930 [diff] [blame] |
Improve error message for enum values Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/96 Change-Id: Id71e659944eef2da6e9fdb2edae0a238943d3b31
diff --git a/src/ast_handlers.hpp b/src/ast_handlers.hpp index 5501247..94121b7 100644 --- a/src/ast_handlers.hpp +++ b/src/ast_handlers.hpp
@@ -461,6 +461,11 @@ if (!schema.leafEnumHasValue(location, {module, leaf.m_name}, ast.m_value)) { _pass(context) = false; + + parserContext.m_errorMsg = "Expected an enum here. Allowed values:"; + for (const auto& it : schema.enumValues(location, {module, leaf.m_name})) { + parserContext.m_errorMsg += " " + it; + } } } };