Fixed customized errors: fcgi and snmp

This commit is contained in:
Olof hagsand 2023-10-26 15:32:25 +02:00
parent 5bdad1870e
commit 978586a493
3 changed files with 5 additions and 3 deletions

View file

@ -151,7 +151,7 @@ restconf_main_config(clicon_handle h,
if ((ret = clixon_xml_parse_string(inline_config, YB_MODULE, yspec, &xrestconf, &xerr)) < 0) if ((ret = clixon_xml_parse_string(inline_config, YB_MODULE, yspec, &xrestconf, &xerr)) < 0)
goto done; goto done;
if (ret == 0){ if (ret == 0){
clixon_netconf_error(xerr, "Inline restconf config", NULL); clixon_netconf_error(h, xerr, "Inline restconf config", NULL);
goto done; goto done;
} }
/* Replace parent w first child */ /* Replace parent w first child */

View file

@ -263,7 +263,7 @@ snmp_scalar_get(clicon_handle h,
goto done; goto done;
/* Detect error XXX Error handling could improve */ /* Detect error XXX Error handling could improve */
if ((xerr = xpath_first(xt, NULL, "/rpc-error")) != NULL){ if ((xerr = xpath_first(xt, NULL, "/rpc-error")) != NULL){
clixon_netconf_error(xerr, "clicon_rpc_get", NULL); clixon_netconf_error(h, xerr, "clicon_rpc_get", NULL);
goto done; goto done;
} }
x = xpath_first(xt, nsc, "%s", xpath); x = xpath_first(xt, nsc, "%s", xpath);

View file

@ -1772,10 +1772,12 @@ netconf_err2cb(clicon_handle h,
{ {
int retval = -1; int retval = -1;
cxobj *x; cxobj *x;
size_t len;
len = cbuf_len(cberr);
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) == 0){ if (cbuf_len(cberr) == len){ /* Same as on-entry, use default */
if ((x=xpath_first(xerr, NULL, "//error-type"))!=NULL) if ((x=xpath_first(xerr, NULL, "//error-type"))!=NULL)
cprintf(cberr, "%s ", xml_body(x)); cprintf(cberr, "%s ", xml_body(x));
if ((x=xpath_first(xerr, NULL, "//error-tag"))!=NULL) if ((x=xpath_first(xerr, NULL, "//error-tag"))!=NULL)