diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-05-16 01:25:19 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-05-18 13:52:47 +0000 |
commit | d02408c2d2d8b26c5eaf97186674abee95f1f490 (patch) | |
tree | e0a9df00694420c457c4aed767f1a7d4421702a9 /ctl-lib/ctl-onload.c | |
parent | fd225ddf14937669a9d7cb38fcfac7463224d514 (diff) |
Detect failure at OnLoad action calls
Be able to detect that an action has failed on an
Onload section processing to avoid retrieving a wrong
context after that.
Change-Id: If694b11eb0a37154b539c421e43bebdb15d498c0
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-onload.c')
-rw-r--r-- | ctl-lib/ctl-onload.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ctl-lib/ctl-onload.c b/ctl-lib/ctl-onload.c index f319103..9baa689 100644 --- a/ctl-lib/ctl-onload.c +++ b/ctl-lib/ctl-onload.c @@ -24,6 +24,7 @@ // onload section receive one action or an array of actions int OnloadConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ) { + int err = 0; // Load time parse actions in control file if (actionsJ != NULL) { @@ -47,9 +48,14 @@ int OnloadConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ source.api = section->actions[idx].api; source.request = AFB_ReqNone; - ActionExecOne(&source, §ion->actions[idx], NULL); + if(!err) + err = ActionExecOne(&source, §ion->actions[idx], NULL); + else { + AFB_ApiError(apiHandle, "Onload action execution failed on: %s", source.uid); + return err; + } } } - return 0; + return err; } |