diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3da43065..42152378 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
# Clixon CHANGELOG
+* When user callbacks such as statedata() call returns -1, clixon_backend no
+ longer silently exits. Instead a log is printed and an RPC error is returned.
+
* Support for non-line scrolling in CLI, eg wrap lines. Set with:
CLICON_CLI_LINESCROLLING 0
diff --git a/apps/backend/backend_client.c b/apps/backend/backend_client.c
index 39f1cb39..9f0c805e 100644
--- a/apps/backend/backend_client.c
+++ b/apps/backend/backend_client.c
@@ -988,8 +988,17 @@ from_client_msg(clicon_handle h,
goto done;
}
else{
- if ((ret = backend_rpc_cb_call(h, xe, ce, cbret)) < 0)
- goto done;
+ clicon_err_reset();
+ if ((ret = backend_rpc_cb_call(h, xe, ce, cbret)) < 0){
+ cprintf(cbret, ""
+ "operation-failed"
+ "rpc"
+ "error"
+ "Internal error:%s"
+ "", clicon_err_reason);
+ clicon_log(LOG_NOTICE, "%s Error in backend_rpc_call:%s", __FUNCTION__, xml_name(xe));
+ goto reply; /* Dont quit here on user callbacks */
+ }
if (ret == 0) /* not handled by callback */
cprintf(cbret, ""
"operation-failed"
diff --git a/apps/backend/clixon_backend_handle.c b/apps/backend/clixon_backend_handle.c
index aec2c292..142b63cd 100644
--- a/apps/backend/clixon_backend_handle.c
+++ b/apps/backend/clixon_backend_handle.c
@@ -505,8 +505,10 @@ backend_rpc_cb_call(clicon_handle h,
rc = rpc_cb_list;
do {
if (strcmp(rc->rc_tag, xml_name(xe)) == 0){
- if ((retval = rc->rc_callback(h, xe, ce, cbret, rc->rc_arg)) < 0)
+ if ((retval = rc->rc_callback(h, xe, ce, cbret, rc->rc_arg)) < 0){
+ clicon_debug(1, "%s Error in: %s", __FUNCTION__, rc->rc_tag);
goto done;
+ }
else{
retval = 1; /* handled */
goto done;