The function afb_msg_json_internal_error was based
on the previous reply standard and was not
used very much. Removing it seems a good idea.
Change-Id: I3dddee9c24ffd8c43c787b9b6a737ab013d757b7
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
/******************************************************************************/
/******************************************************************************/
+static const char _internal_error_[] = "internal-error";
+
+/******************************************************************************/
+
static int store_reply(
struct json_object *iobject, const char *ierror, const char *iinfo,
struct json_object **sobject, char **serror, char **sinfo)
static int store_reply(
struct json_object *iobject, const char *ierror, const char *iinfo,
struct json_object **sobject, char **serror, char **sinfo)
callreq->jobloop = jobloop;
afb_export_process_xreq(callreq->export, &callreq->xreq);
} else {
callreq->jobloop = jobloop;
afb_export_process_xreq(callreq->export, &callreq->xreq);
} else {
- afb_xreq_reply(&callreq->xreq, NULL, "internal-error", NULL);
+ afb_xreq_reply(&callreq->xreq, NULL, _internal_error_, NULL);
afb_xreq_unhooked_unref(&callreq->xreq);
interr:
afb_xreq_unhooked_unref(&callreq->xreq);
interr:
- return store_reply(NULL, "internal-error", NULL, object, info, error);
+ return store_reply(NULL, _internal_error_, NULL, object, info, error);
}
/******************************************************************************/
}
/******************************************************************************/
callreq = callreq_create(export, caller, api, verb, args, flags, mode);
if (!callreq)
callreq = callreq_create(export, caller, api, verb, args, flags, mode);
if (!callreq)
- final(closure, NULL, "internal-error", NULL, (union callback){ .any = callback }, export, caller);
+ final(closure, NULL, _internal_error_, NULL, (union callback){ .any = callback }, export, caller);
else {
callreq->callback.any = callback;
callreq->closure = closure;
else {
callreq->callback.any = callback;
callreq->closure = closure;
afb_xreq_unhooked_unref(&callreq->xreq);
interr:
if (object)
afb_xreq_unhooked_unref(&callreq->xreq);
interr:
if (object)
- *object = afb_msg_json_internal_error();
+ *object = afb_msg_json_reply(NULL, _internal_error_, NULL, NULL);
callreq = callreq_create(export, caller, api, verb, args, flags, mode);
if (!callreq) {
callreq = callreq_create(export, caller, api, verb, args, flags, mode);
if (!callreq) {
- ie = afb_msg_json_internal_error();
+ ie = afb_msg_json_reply(NULL, _internal_error_, NULL, NULL);
final(closure, -1, ie, (union callback){ .any = callback }, export, caller);
json_object_put(ie);
} else {
final(closure, -1, ie, (union callback){ .any = callback }, export, caller);
json_object_put(ie);
} else {
-struct json_object *afb_msg_json_internal_error()
-{
- return afb_msg_json_reply(NULL, "failed", "internal error", NULL);
-}
-
extern struct json_object *afb_msg_json_event(const char *event, struct json_object *object);
extern struct json_object *afb_msg_json_event(const char *event, struct json_object *object);
-extern struct json_object *afb_msg_json_internal_error();