Only alloc if status <> ok

pull/13364/head
ncteisen 7 years ago
parent 14c60f1d12
commit 9e2be4998e
  1. 8
      src/core/lib/transport/error_utils.cc

@ -44,10 +44,6 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error,
grpc_millis deadline, grpc_status_code* code,
grpc_slice* slice, grpc_http2_error_code* http_error,
const char** full_error_details) {
if (full_error_details != NULL) {
*full_error_details = gpr_strdup(grpc_error_string(error));
}
// Start with the parent error and recurse through the tree of children
// until we find the first one that has a status code.
grpc_error* found_error =
@ -74,6 +70,10 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error,
}
if (code != nullptr) *code = status;
if (full_error_details != NULL && status != GRPC_STATUS_OK) {
*full_error_details = gpr_strdup(grpc_error_string(error));
}
if (http_error != nullptr) {
if (grpc_error_get_int(found_error, GRPC_ERROR_INT_HTTP2_ERROR, &integer)) {
*http_error = (grpc_http2_error_code)integer;

Loading…
Cancel
Save