Add a way to report rpc-errors from a plugin

Add plugin_rpc_err(), which works something like clixon_err, but it
saves error information from a plugin for reporting rpc-errors that
need to be returned.

Also add plugin_rpc_err_xml(), which does an XML formatted error.

The plugin error is stored in the clixon_handle and retrieved from
there.

Signed-off-by: Corey Minyard <corey@minyard.net>
This commit is contained in:
Corey Minyard 2024-09-27 15:14:46 -05:00 committed by Olof Hagsand
parent 3a1aa4052f
commit 9bdacc8671
2 changed files with 211 additions and 0 deletions

View file

@ -552,4 +552,11 @@ const char *clixon_auth_type_int2str(clixon_auth_type_t auth_type);
int clixon_plugin_module_init(clixon_handle h);
int clixon_plugin_module_exit(clixon_handle h);
int clixon_plugin_rpc_err(clixon_handle h, const char *ns,
const char *type, const char *tag, const char *info,
const char *severity, const char *fmt, ...);
int clixon_plugin_rpc_err_set(clixon_handle h);
int clixon_plugin_report_err(clixon_handle h, cbuf *cbret);
int clixon_plugin_report_err_xml(clixon_handle h, cxobj **xreg, char *err, ...);
#endif /* _CLIXON_PLUGIN_H_ */