New feature: [Customized NETCONF error message](https://github.com/clicon/clixon/issues/454)
* Added new callback `.ca_errmsg` * Changed signature of `clicon_netconf_error()` and `netconf_err2cb()`
This commit is contained in:
parent
e7313fc9a2
commit
5bdad1870e
25 changed files with 258 additions and 122 deletions
|
|
@ -231,7 +231,7 @@ main(int argc,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (netconf_err2cb(xerr, cb) < 0)
|
||||
if (netconf_err2cb(h, xerr, cb) < 0)
|
||||
goto done;
|
||||
fprintf(stderr, "xml validation error: %s\n", cbuf_get(cb));
|
||||
goto done;
|
||||
|
|
@ -253,7 +253,7 @@ main(int argc,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (netconf_err2cb(xerr, cb) < 0)
|
||||
if (netconf_err2cb(h, xerr, cb) < 0)
|
||||
goto done;
|
||||
fprintf(stderr, "xml validation error: %s\n", cbuf_get(cb));
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ validate_tree(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (netconf_err2cb(xerr, cbret) < 0)
|
||||
if (netconf_err2cb(h, xerr, cbret) < 0)
|
||||
goto done;
|
||||
fprintf(stderr, "xml validation error: %s\n", cbuf_get(cbret));
|
||||
goto done;
|
||||
|
|
@ -278,7 +278,7 @@ main(int argc,
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
clixon_netconf_error(xerr, "Parse top file", NULL);
|
||||
clixon_netconf_error(h, xerr, "Parse top file", NULL);
|
||||
goto done;
|
||||
}
|
||||
if (validate_tree(h, xtop, yspec) < 0)
|
||||
|
|
@ -304,7 +304,7 @@ main(int argc,
|
|||
if ((ret = clixon_json_parse_file(fp, 1, top_input_filename?YB_PARENT:YB_MODULE, yspec, &xt, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_netconf_error(xerr, "util_xml", NULL);
|
||||
clixon_netconf_error(h, xerr, "util_xml", NULL);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
|
@ -320,7 +320,7 @@ main(int argc,
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
clixon_netconf_error(xerr, "util_xml", NULL);
|
||||
clixon_netconf_error(h, xerr, "util_xml", NULL);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ main(int argc, char **argv)
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
clixon_netconf_error(xerr, "Parsing base xml", NULL);
|
||||
clixon_netconf_error(h, xerr, "Parsing base xml", NULL);
|
||||
goto done;
|
||||
}
|
||||
/* Get base subtree by xpath */
|
||||
|
|
@ -216,7 +216,7 @@ main(int argc, char **argv)
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
clixon_netconf_error(xerr, "Parsing secondary xml", NULL);
|
||||
clixon_netconf_error(h, xerr, "Parsing secondary xml", NULL);
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
|
@ -227,7 +227,7 @@ main(int argc, char **argv)
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
clixon_netconf_error(xerr, "Parsing secondary xml", NULL);
|
||||
clixon_netconf_error(h, xerr, "Parsing secondary xml", NULL);
|
||||
goto done;
|
||||
}
|
||||
if (xpath == NULL)
|
||||
|
|
@ -250,7 +250,7 @@ main(int argc, char **argv)
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
clixon_netconf_error(xerr, "Parsing secondary xml", NULL);
|
||||
clixon_netconf_error(h, xerr, "Parsing secondary xml", NULL);
|
||||
goto done;
|
||||
}
|
||||
/* Get secondary subtree by xpath */
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ main(int argc,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (netconf_err2cb(xerr, cbret) < 0)
|
||||
if (netconf_err2cb(h, xerr, cbret) < 0)
|
||||
goto done;
|
||||
fprintf(stderr, "xml validation error: %s\n", cbuf_get(cbret));
|
||||
goto done;
|
||||
|
|
@ -349,7 +349,7 @@ main(int argc,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (netconf_err2cb(xerr, cbret) < 0)
|
||||
if (netconf_err2cb(h, xerr, cbret) < 0)
|
||||
goto done;
|
||||
fprintf(stderr, "xml validation error: %s\n", cbuf_get(cbret));
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue