Does ConfD have the API to print out customized error message?

Hi Experts,

As the subject, does ConfD have the API to print out customized error message to ConfD CLI?

I want to print out error message in the call-back function when encountering some unexpected condition.

Thanks in advance.

BR,
Harry Huang

See Can maapi_cli_printf/write be called outside action callback?

Hello,

in case you have access to the user session id, you can use maapi_cli_printf. Descrbed in ConfD User Guide under confd_lib_maapi section.

  Write to the CLI using printf formatting. This function is
  intended to be called from inside an action
  callback when invoked from the CLI.

Regards,

Michal Novak

I don’t know what kind of “call-back function” you have in mind, but in general callbacks should not print error messages to the northbound agent. It can only work at all for the CLI, and even there it may appear as a random asynchronous message rather than associated with a specific CLI command. Instead, error information should be returned by the callback, by using one of the confd_xxx_seterr() / confd_xxx_seterr_extended() / confd_xxx_seterr_extended_info() functions and returning CONFD_ERR. Then it can be rendered appropriately for all NB agents.