From: José Bollo Date: Thu, 23 Jun 2016 20:03:27 +0000 (+0200) Subject: binding: report errors correctly X-Git-Tag: 2.0.2~11 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-main.git;a=commitdiff_plain;h=8753c48ed498805cec5fbc6096cd6fae3afa0da9 binding: report errors correctly Change-Id: I160cff69ca344ac59df5e8bd9a29b936e8b11797 Signed-off-by: José Bollo --- diff --git a/src/afm-main-binding.c b/src/afm-main-binding.c index 1af3d8a..919caa4 100644 --- a/src/afm-main-binding.c +++ b/src/afm-main-binding.c @@ -136,13 +136,13 @@ static struct json_object *embed(const char *tag, struct json_object *obj) /* * Callback for replies made by 'embed_call_void'. */ -static void embed_call_void_callback(int status, struct json_object *obj, struct memo *memo) +static void embed_call_void_callback(int iserror, struct json_object *obj, struct memo *memo) { DEBUG(binder, "(afm-main-binding) %s(true) -> %s\n", memo->method, obj ? json_object_to_json_string(obj) : "NULL"); - if (obj == NULL) { - memo_fail(memo, "framework daemon failure"); + if (iserror) { + memo_fail(memo, obj ? json_object_get_string(obj) : "framework daemon failure"); } else { memo_success(memo, embed(memo->method, json_object_get(obj)), NULL); } @@ -167,13 +167,13 @@ static void embed_call_void(struct afb_req request, const char *method) /* * Callback for replies made by 'call_appid' and 'call_runid'. */ -static void call_xxxid_callback(int status, struct json_object *obj, struct memo *memo) +static void call_xxxid_callback(int iserror, struct json_object *obj, struct memo *memo) { DEBUG(binder, "(afm-main-binding) %s -> %s\n", memo->method, obj ? json_object_to_json_string(obj) : "NULL"); - if (obj == NULL) { - memo_fail(memo, "framework daemon failure"); + if (iserror) { + memo_fail(memo, obj ? json_object_get_string(obj) : "framework daemon failure"); } else { memo_success(memo, json_object_get(obj), NULL); } @@ -240,13 +240,13 @@ static void detail(struct afb_req request) call_appid(request, _detail_); } -static void start_callback(int status, struct json_object *obj, struct memo *memo) +static void start_callback(int iserror, struct json_object *obj, struct memo *memo) { DEBUG(binder, "(afm-main-binding) %s -> %s\n", memo->method, obj ? json_object_to_json_string(obj) : "NULL"); - if (obj == NULL) { - memo_fail(memo, "framework daemon failure"); + if (iserror) { + memo_fail(memo, obj ? json_object_get_string(obj) : "framework daemon failure"); } else { obj = json_object_get(obj); if (json_object_get_type(obj) == json_type_int) @@ -318,12 +318,12 @@ static void state(struct afb_req request) call_runid(request, _state_); } -static void install_callback(int status, struct json_object *obj, struct memo *memo) +static void install_callback(int iserror, struct json_object *obj, struct memo *memo) { struct json_object *added; - if (obj == NULL) { - memo_fail(memo, "framework daemon failure"); + if (iserror) { + memo_fail(memo, obj ? json_object_get_string(obj) : "framework daemon failure"); } else { if (json_object_object_get_ex(obj, _added_, &added)) obj = added;