How to return customerized error message in confd_data_cbs

Hi

as the document mentioned, there are those function providing as supplementary message for CONFD_ERR.
confd_xx_seterr(),
confd_xx_seterr_extended(),
confd_xx_seterr_extended_info()

They are works for different callbacks respectively.

However, non of them are designed for confd_data_cbs, for instance get_elem(). I have tried using confd_trans_seterr_extended before return error. It gave a error message in CLI but not for Netconf interface.

So, my question is, how do I customize the error message for NBI (CLI and NETCONF) when there is a error occur during confd_data_cbs?

Hi,

Have you set /confdConfig/netconf/rpcErrors to “inline”? Default is “close”. See the confd.conf(5) man page.
Are you calling the confd_trans_seterr_extended_info() function before returning CONFD_ERR from the callback? See the confd_lib_lib(3) man page section EXTENDED ERROR REPORTING for details on the confd_trans_seterr_extended_info() function.

hi cohult

According to the description of confd_trans_seterr_extended, it should populate the error to netconf interface as well.

This function is used by the application to set an error string. The next transaction or data callback which returns CONFD_ERR will have this error description attached to it. This error may propagate to the CLI, the NETCONF manager, the Web UI or the log files depending on the situation. We also use this function to propagate warning messages from the validate() callback if we are doing semantic validation in C. The fmt argument is a printf style format string.

It is helpful to set /confdConfig/netconf/rpcErrors to “inline”, I can see the error message populated to netconf after this setting

<?xml version="1.0" encoding="UTF-8"?> application operation-failed error /hst:hosts/host{buzz}: inconsistent value: this is test error in get_ele host

Thanks