aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/surface
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-06-23 10:47:05 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-06-23 10:47:05 -0700
commit9f97cca37b21fbac12d840fa2337f1fba251e77c (patch)
treee89af3f118293ee8c20f81d97db8c848400a17f4 /src/core/lib/surface
parent0badbe8b119c7375dfb0f8e6f853180009a2ffb7 (diff)
Fix error handling in grpc_call_create().
Diffstat (limited to 'src/core/lib/surface')
-rw-r--r--src/core/lib/surface/call.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index d64ca64a15..2e89393815 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -266,8 +266,18 @@ grpc_call *grpc_call_create(
destroy_call, call, call->context,
server_transport_data,
CALL_STACK_FROM_CALL(call));
-// FIXME: handle error (probably requires changing this function's API)
-GPR_ASSERT(error == GRPC_ERROR_NONE);
+ if (error != GRPC_ERROR_NONE) {
+ intptr_t status;
+ if (!grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, &status))
+ status = GRPC_STATUS_UNKNOWN;
+ const char* error_string = grpc_error_string(error);
+ received_status* status_struct = &call->status[STATUS_FROM_CORE];
+ status_struct->is_set = true;
+ status_struct->code = status;
+ status_struct->details = grpc_mdstr_from_string(error_string);
+ grpc_error_free_string(error_string);
+ grpc_error_unref(error);
+ }
if (cq != NULL) {
GPR_ASSERT(
pollset_set_alternative == NULL &&