log CHANGE some errors made more specific
For a NETCONF server to be able to generate
specific error messages as defined in
the YANG RFC.
diff --git a/src/resolve.c b/src/resolve.c
index 786ec24..bd05eb4 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -4113,7 +4113,13 @@
lyxp_set_cast(&set, LYXP_SET_BOOLEAN, node, LYXP_MUST);
if (!set.value.bool) {
- LOGVAL(LYE_NOCOND, LY_VLOG_LYD, node, "Must", must[i].expr);
+ LOGVAL(LYE_NOMUST, LY_VLOG_LYD, node, must[i].expr);
+ if (must[i].emsg) {
+ LOGVAL(LYE_SPEC, LY_VLOG_LYD, node, must[i].emsg);
+ }
+ if (must[i].eapptag) {
+ strncpy(((struct ly_err *)&ly_errno)->apptag, must[i].eapptag, LY_APPTAG_LEN - 1);
+ }
return 1;
}
}
@@ -4251,7 +4257,7 @@
lyxp_set_cast(&set, LYXP_SET_BOOLEAN, node, LYXP_WHEN);
if (!set.value.bool) {
ly_vlog_hide(1);
- LOGVAL(LYE_NOCOND, LY_VLOG_LYD, node, "When", ((struct lys_node_container *)node->schema)->when->cond);
+ LOGVAL(LYE_NOWHEN, LY_VLOG_LYD, node, ((struct lys_node_container *)node->schema)->when->cond);
ly_vlog_hide(0);
node->when_status |= LYD_WHEN_FALSE;
goto cleanup;
@@ -4286,7 +4292,7 @@
lyxp_set_cast(&set, LYXP_SET_BOOLEAN, ctx_node, LYXP_WHEN);
if (!set.value.bool) {
ly_vlog_hide(1);
- LOGVAL(LYE_NOCOND, LY_VLOG_LYD, node, "When", ((struct lys_node_uses *)parent)->when->cond);
+ LOGVAL(LYE_NOWHEN, LY_VLOG_LYD, node, ((struct lys_node_uses *)parent)->when->cond);
ly_vlog_hide(0);
node->when_status |= LYD_WHEN_FALSE;
goto cleanup;
@@ -4318,7 +4324,7 @@
if (!set.value.bool) {
ly_vlog_hide(1);
- LOGVAL(LYE_NOCOND, LY_VLOG_LYD, node, "When", ((struct lys_node_augment *)parent->parent)->when->cond);
+ LOGVAL(LYE_NOWHEN, LY_VLOG_LYD, node, ((struct lys_node_augment *)parent->parent)->when->cond);
ly_vlog_hide(0);
node->when_status |= LYD_WHEN_FALSE;
goto cleanup;
@@ -4868,8 +4874,7 @@
if (!leaf->value.leafref) {
/* reference not found */
- LOGVAL(LYE_NORESOLV, LY_VLOG_LYD, leaf, sleaf->type.info.lref.path);
- LOGVAL(LYE_SPEC, LY_VLOG_LYD, leaf, "Leafref value \"%s\" did not match any node value.", leaf->value_str);
+ LOGVAL(LYE_NOLEAFREF, LY_VLOG_LYD, leaf, sleaf->type.info.lref.path, leaf->value_str);
return EXIT_FAILURE;
}
break;
@@ -4882,7 +4887,7 @@
if (ly_errno) {
return -1;
} else if (sleaf->type.info.inst.req > -1) {
- LOGVAL(LYE_NORESOLV, LY_VLOG_LYD, leaf, leaf->value_str);
+ LOGVAL(LYE_NOREQINS, LY_VLOG_LYD, leaf, leaf->value_str);
return EXIT_FAILURE;
} else {
LOGVRB("There is no instance of \"%s\", but it is not required.", leaf->value_str);