aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/samples/HelloWorld.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-07-03 13:57:19 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-07-03 14:13:46 +0200
commit052c3aee6362b2e33c060e0fbddd68439bb73dcb (patch)
treeacb632eac2bdd273a90fdda5a7982c507b83da9a /bindings/samples/HelloWorld.c
parent119e23a69678d0d71a81d8460b4bc0099c8c9729 (diff)
Make status common
Make all error status for bindings use a common convention: a negative value means an error. Change-Id: Id09610051295810f04f00477d7ec1d9771bf7975 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'bindings/samples/HelloWorld.c')
-rw-r--r--bindings/samples/HelloWorld.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bindings/samples/HelloWorld.c b/bindings/samples/HelloWorld.c
index 89ed829c..731ea530 100644
--- a/bindings/samples/HelloWorld.c
+++ b/bindings/samples/HelloWorld.c
@@ -169,10 +169,10 @@ static void pingJson (afb_req request) {
ping(request, jresp, "pingJson");
}
-static void subcallcb (void *prequest, int iserror, json_object *object)
+static void subcallcb (void *prequest, int status, json_object *object)
{
afb_req request = afb_req_unstore(prequest);
- if (iserror)
+ if (status < 0)
afb_req_fail(request, "failed", json_object_to_json_string(object));
else
afb_req_success(request, json_object_get(object), NULL);
@@ -204,7 +204,7 @@ static void subcallsync (afb_req request)
afb_req_fail(request, "failed", "bad arguments");
else {
rc = afb_req_subcall_sync(request, api, verb, object, &result);
- if (rc)
+ if (rc >= 0)
afb_req_success(request, result, NULL);
else {
afb_req_fail(request, "failed", json_object_to_json_string(result));
@@ -287,10 +287,10 @@ static void eventpush (afb_req request)
json_object_put(object);
}
-static void callcb (void *prequest, int iserror, json_object *object)
+static void callcb (void *prequest, int status, json_object *object)
{
afb_req request = afb_req_unstore(prequest);
- if (iserror)
+ if (status < 0)
afb_req_fail(request, "failed", json_object_to_json_string(object));
else
afb_req_success(request, json_object_get(object), NULL);
@@ -322,7 +322,7 @@ static void callsync (afb_req request)
afb_req_fail(request, "failed", "bad arguments");
else {
rc = afb_service_call_sync(api, verb, object, &result);
- if (rc)
+ if (rc >= 0)
afb_req_success(request, result, NULL);
else {
afb_req_fail(request, "failed", json_object_to_json_string(result));