aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-05-29 14:44:13 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-05-31 16:07:11 +0200
commitaf9fdaac5af2283bbd1caa17ced49bdf420523a8 (patch)
treefda65d8a2e1cdf4f9e9946a8d20e4c49881da264
parentd915272ab0fef010d0cc84710588cb947f5215d2 (diff)
Add prints when a controller error is detected
Add prints when a controller error is detected at json loading/exection. BUG-AGL: SPEC-2329 Change-Id: I8b3319115ce98694e7f382fd39c39e5422a38021 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--src/4a-internals-hal/4a-internals-hal-api-loader.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-api-loader.c b/src/4a-internals-hal/4a-internals-hal-api-loader.c
index 68e3bb7..f18f651 100644
--- a/src/4a-internals-hal/4a-internals-hal-api-loader.c
+++ b/src/4a-internals-hal/4a-internals-hal-api-loader.c
@@ -69,6 +69,8 @@ static afb_verb_t InternalHalApiStaticVerbs[] =
static int InternalHalInitOneApi(afb_api_t apiHandle)
{
+ int err;
+
CtlConfigT *ctrlConfig;
struct HalData *currentHalData;
@@ -111,7 +113,16 @@ static int InternalHalInitOneApi(afb_api_t apiHandle)
// TBD JAI: handle refresh of hal status for dynamic card (/dev/by-id)
- return CtlConfigExec(apiHandle, ctrlConfig);
+ err = CtlConfigExec(apiHandle, ctrlConfig);
+ if(err < 0) {
+ AFB_API_ERROR(apiHandle, "Error %i caught when trying to apply current internal hal controller sections", err);
+ return -5;
+ }
+
+ if(err > 0)
+ AFB_API_WARNING(apiHandle, "Warning %i raised when trying to apply current internal hal controller sections", err);
+
+ return 0;
}
static int InternalHalLoadOneApi(void *cbdata, afb_api_t apiHandle)
@@ -144,11 +155,14 @@ static int InternalHalLoadOneApi(void *cbdata, afb_api_t apiHandle)
// Load section for corresponding Api
err = CtlLoadSections(apiHandle, ctrlConfig, ctrlCurrentSections);
- if(err) {
- AFB_API_ERROR(apiHandle, "Didn't succeed to load current internal hal controller section");
+ if(err < 0) {
+ AFB_API_ERROR(apiHandle, "Error %i caught when trying to load current internal hal controller sections", err);
return -4;
}
+ if(err > 0)
+ AFB_API_WARNING(apiHandle, "Warning %i raised when trying to load current internal hal controller sections", err);
+
// Declare an event manager for this Api
afb_api_on_event(apiHandle, InternalHalDispatchApiEvent);