Netconf error callback resilient to prefixes
Reformat json code
This commit is contained in:
parent
e619632ac7
commit
7713e79dc2
3 changed files with 47 additions and 47 deletions
|
|
@ -249,20 +249,20 @@ example_cli_errmsg(clicon_handle h,
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
cxobj *x;
|
cxobj *x;
|
||||||
|
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-type"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-type", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, "%s ", xml_body(x));
|
cprintf(cberr, "%s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-tag"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-tag", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, "%s ", xml_body(x));
|
cprintf(cberr, "%s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-message"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-message", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, "%s ", xml_body(x));
|
cprintf(cberr, "%s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-info")) != NULL &&
|
if ((x = xml_find_type(xerr, NULL, "error-info", CX_ELMNT)) != NULL &&
|
||||||
xml_child_nr(x) > 0){
|
xml_child_nr(x) > 0){
|
||||||
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, NULL, -1, 0) < 0)
|
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, NULL, -1, 0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-app-tag"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-app-tag", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, ": %s ", xml_body(x));
|
cprintf(cberr, ": %s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-path"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-path", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, ": %s ", xml_body(x));
|
cprintf(cberr, ": %s ", xml_body(x));
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
|
|
|
||||||
|
|
@ -1778,20 +1778,20 @@ netconf_err2cb(clicon_handle h,
|
||||||
if (clixon_plugin_netconf_errmsg_all(h, xerr, cberr) < 0)
|
if (clixon_plugin_netconf_errmsg_all(h, xerr, cberr) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (cbuf_len(cberr) == len){ /* Same as on-entry, use default */
|
if (cbuf_len(cberr) == len){ /* Same as on-entry, use default */
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-type"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-type", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, "%s ", xml_body(x));
|
cprintf(cberr, "%s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-tag"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-tag", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, "%s ", xml_body(x));
|
cprintf(cberr, "%s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-message"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-message", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, "%s ", xml_body(x));
|
cprintf(cberr, "%s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-info")) != NULL &&
|
if ((x = xml_find_type(xerr, NULL, "error-info", CX_ELMNT)) != NULL &&
|
||||||
xml_child_nr(x) > 0){
|
xml_child_nr(x) > 0){
|
||||||
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, NULL, -1, 0) < 0)
|
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, NULL, -1, 0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-app-tag"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-app-tag", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, ": %s ", xml_body(x));
|
cprintf(cberr, ": %s ", xml_body(x));
|
||||||
if ((x=xpath_first(xerr, NULL, "//error-path"))!=NULL)
|
if ((x = xml_find_type(xerr, NULL, "error-path", CX_ELMNT)) != NULL)
|
||||||
cprintf(cberr, ": %s ", xml_body(x));
|
cprintf(cberr, ": %s ", xml_body(x));
|
||||||
}
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue