Changed ca_errmsg callback to a more generic variant

Includes all error, log and debug messages
See [Customized NETCONF error message](https://github.com/clicon/clixon/issues/454)
This commit is contained in:
Olof hagsand 2023-12-22 22:27:54 +01:00
parent 798a9fbfcb
commit 9e54f0602f
83 changed files with 739 additions and 616 deletions

View file

@ -462,13 +462,7 @@ cli_dbxml(clixon_handle h,
if ((ret = api_path2xml(api_path, yspec0, xtop, YC_DATANODE, 1, &xbot, &y, &xerr)) < 0)
goto done;
if (ret == 0){
if ((cb = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
if (netconf_err2cb(h, xerr, cb) < 0)
goto done;
clixon_err(OE_CFG, EINVAL, "api-path syntax error \"%s\": %s", api_path_fmt, cbuf_get(cb));
clixon_err_netconf(h, OE_CFG, EINVAL, xerr, "api-path syntax error \"%s\"", api_path_fmt);
goto done;
}
}

View file

@ -488,7 +488,9 @@ cli_handler_err(FILE *f)
if (clixon_err_category()){
/* Check if error is already logged on stderr */
if ((clixon_get_logflags() & CLIXON_LOG_STDERR) == 0){
fprintf(f, "%s: %s", clixon_err_str(), clixon_err_reason());
if (clixon_err_category() != -1)
fprintf(f, "%s: ", clixon_err_str());
fprintf(f, "%s", clixon_err_reason());
if (clixon_err_subnr())
fprintf(f, ": %s", strerror(clixon_err_subnr()));
fprintf(f, "\n");