diff options
author | 2017-09-02 11:37:39 +0200 | |
---|---|---|
committer | 2017-09-02 12:18:23 +0200 | |
commit | 6ddb6a0910ee11e061cebe87a82d5343d06b1f9d (patch) | |
tree | 55db2b60674b7371222c34b387cf6d55e4e0b2e3 /high-viwi-binding/high-viwi-binding.cpp | |
parent | ca5f8050dd74d39bced479914bab7917f4f2df51 (diff) |
Handle load config return value and request replyclaneys-dev
Now verb 'load' make a reply and return error code on failure
Change-Id: I4fd1ae5117598624d910c1d12de55b92cb5bbdbb
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'high-viwi-binding/high-viwi-binding.cpp')
-rw-r--r-- | high-viwi-binding/high-viwi-binding.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/high-viwi-binding/high-viwi-binding.cpp b/high-viwi-binding/high-viwi-binding.cpp index e42a175..3b54003 100644 --- a/high-viwi-binding/high-viwi-binding.cpp +++ b/high-viwi-binding/high-viwi-binding.cpp @@ -45,7 +45,7 @@ void unsubscribe(afb_req request) if(high.unsubscribe(request)) afb_req_success(request, NULL, NULL); else - afb_req_fail(request, "error", NULL); + afb_req_fail(request, "error when unsubscribe", NULL); } /// @brief verb that loads JSON configuration (old high.json file now) @@ -55,7 +55,11 @@ void load(afb_req request) const char* confd; wrap_json_unpack(args, "{s:s}", "path", &confd); - high.parseConfigAndSubscribe(confd); + int ret = high.parseConfigAndSubscribe(confd); + if( ret == 0) + afb_req_success(request, NULL, NULL); + else + afb_req_fail_f(request, "Loading configuration or subscription error", "Error code: %d", ret); } /// @brief entry point for get requests. Treatment itself is made in High class. |