data tree CHANGE use either schema or data node for logging
... depending on whether the data re connected
or not. Tests adjusted accordingly.
diff --git a/src/tree_data.c b/src/tree_data.c
index d22183a..b7e695e 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -70,7 +70,11 @@
if (ret && (ret != LY_EINCOMPLETE)) {
if (err) {
/* node may not be connected yet so use the schema node */
- LOGVAL(ctx, LY_VLOG_LYSC, node->schema, err->vecode, err->msg);
+ if (!node->parent && lysc_data_parent(node->schema)) {
+ LOGVAL(ctx, LY_VLOG_LYSC, node->schema, err->vecode, err->msg);
+ } else {
+ LOGVAL(ctx, LY_VLOG_LYD, node, err->vecode, err->msg);
+ }
ly_err_free(err);
}
goto error;