static void rpcCall0(String* function, Dict* args, struct Context* ctx, struct Allocator* alloc, bool exitIfError) { struct AdminClient_Result* res = AdminClient_rpcCall(function, args, ctx->client, alloc); if (res->err) { Log_critical(ctx->logger, "Failed to make function call [%s], error: [%s]", AdminClient_errorString(res->err), function->bytes); die(res, ctx, alloc); } String* error = Dict_getString(res->responseDict, String_CONST("error")); if (error && !String_equals(error, String_CONST("none"))) { if (exitIfError) { Log_critical(ctx->logger, "Got error [%s] calling [%s]", error->bytes, function->bytes); die(res, ctx, alloc); } Log_warn(ctx->logger, "Got error [%s] calling [%s], ignoring.", error->bytes, function->bytes); } }
static int rpcCall0(String* function, Dict* args, struct Context* ctx, struct Allocator* alloc, Dict** resultP, bool exitIfError) { ctx->currentReqAlloc = Allocator_child(alloc); ctx->currentResult = NULL; struct AdminClient_Promise* promise = AdminClient_rpcCall(function, args, ctx->client, alloc); promise->callback = rpcCallback; promise->userData = ctx; EventBase_beginLoop(ctx->base); struct AdminClient_Result* res = ctx->currentResult; Assert_true(res); if (res->err) { Log_critical(ctx->logger, "Failed to make function call [%s], error: [%s]", AdminClient_errorString(res->err), function->bytes); die(res, ctx, alloc); } String* error = Dict_getString(res->responseDict, String_CONST("error")); int ret = 0; if (error && !String_equals(error, String_CONST("none"))) { if (exitIfError) { Log_critical(ctx->logger, "Got error [%s] calling [%s]", error->bytes, function->bytes); die(res, ctx, alloc); } Log_warn(ctx->logger, "Got error [%s] calling [%s], ignoring.", error->bytes, function->bytes); ret = 1; } if (resultP) { *resultP = res->responseDict; } else { Allocator_free(ctx->currentReqAlloc); } ctx->currentReqAlloc = NULL; return ret; }
static void rpcCall(String* function, Dict* args, struct Context* ctx, struct Allocator* alloc) { struct AdminClient_Result* res = AdminClient_rpcCall(function, args, ctx->client, alloc); if (res->err) { Log_critical2(ctx->logger, "Failed to make function call [%s], error: [%s]", AdminClient_errorString(res->err), function->bytes); showMsg(res, ctx); exit(-1); } String* error = Dict_getString(res->responseDict, String_CONST("error")); if (error && !String_equals(error, String_CONST("none"))) { Log_critical2(ctx->logger, "Router responses with error: [%s]\nCalling function: [%s]", error->bytes, function->bytes); showMsg(res, ctx); exit(-1); } }