aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-11-15 23:52:55 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2017-11-15 23:52:55 -0800
commit9e2be4998e453ef66a595b230519a006ca257529 (patch)
treea0fad5176b5e0ee8529e6bf3f13408cb068cbb6d /src/core/lib
parent14c60f1d12dd9b4ac67ab8addae0c27f5971e55a (diff)
Only alloc if status <> ok
Diffstat (limited to 'src/core/lib')
-rw-r--r--src/core/lib/transport/error_utils.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/lib/transport/error_utils.cc b/src/core/lib/transport/error_utils.cc
index bcaedeeac9..723663a6d7 100644
--- a/src/core/lib/transport/error_utils.cc
+++ b/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;