From 6e40cbdba196d6f7d41a43802f4deea51dd7b048 Mon Sep 17 00:00:00 2001 From: Amin Ben Romdhane Date: Mon, 13 Nov 2023 17:36:54 +0100 Subject: [PATCH] Shows fault messages reported from micro-service instead of standard messages. --- libbbfdm-api/dmbbf.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libbbfdm-api/dmbbf.c b/libbbfdm-api/dmbbf.c index 870435b4..ba5a2ed4 100644 --- a/libbbfdm-api/dmbbf.c +++ b/libbbfdm-api/dmbbf.c @@ -1308,8 +1308,11 @@ static int add_ubus_object(struct dmctx *dmctx, struct dmnode *node) res_obj = json_object_array_get_idx(res_array, i); char *fault = dmjson_get_value(res_obj, 1, "fault"); - if (DM_STRLEN(fault)) + if (DM_STRLEN(fault)) { + char *fault_msg = dmjson_get_value(res_obj, 1, "fault_msg"); + bbfdm_set_fault_message(dmctx, "%s", fault_msg); return DM_STRTOUL(fault); + } char *data = dmjson_get_value(res_obj, 1, "data"); @@ -1353,8 +1356,11 @@ static int del_ubus_object(struct dmctx *dmctx, struct dmnode *node) dmctx->stop = 1; char *fault = dmjson_get_value(res_obj, 1, "fault"); - if (DM_STRLEN(fault)) + if (DM_STRLEN(fault)) { + char *fault_msg = dmjson_get_value(res_obj, 1, "fault_msg"); + bbfdm_set_fault_message(dmctx, "%s", fault_msg); return DM_STRTOUL(fault); + } } return 0; @@ -1428,8 +1434,11 @@ static int set_ubus_value(struct dmctx *dmctx, struct dmnode *node) dmctx->stop = 1; char *fault = dmjson_get_value(res_obj, 1, "fault"); - if (DM_STRLEN(fault)) + if (DM_STRLEN(fault)) { + char *fault_msg = dmjson_get_value(res_obj, 1, "fault_msg"); + bbfdm_set_fault_message(dmctx, "%s", fault_msg); return DM_STRTOUL(fault); + } } return 0;