aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/transport/error_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/transport/error_utils.c')
-rw-r--r--src/core/lib/transport/error_utils.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/lib/transport/error_utils.c b/src/core/lib/transport/error_utils.c
index ef55e561fb..4e70f8749d 100644
--- a/src/core/lib/transport/error_utils.c
+++ b/src/core/lib/transport/error_utils.c
@@ -55,7 +55,7 @@ static grpc_error *recursively_find_error_with_field(grpc_error *error,
}
void grpc_error_get_status(grpc_error *error, gpr_timespec deadline,
- grpc_status_code *code, const char **msg,
+ grpc_status_code *code, grpc_slice *slice,
grpc_http2_error_code *http_error) {
// Start with the parent error and recurse through the tree of children
// until we find the first one that has a status code.
@@ -97,11 +97,11 @@ void grpc_error_get_status(grpc_error *error, gpr_timespec deadline,
// If the error has a status message, use it. Otherwise, fall back to
// the error description.
- if (msg != NULL) {
- *msg = grpc_error_get_str(found_error, GRPC_ERROR_STR_GRPC_MESSAGE);
- if (*msg == NULL && error != GRPC_ERROR_NONE) {
- *msg = grpc_error_get_str(found_error, GRPC_ERROR_STR_DESCRIPTION);
- if (*msg == NULL) *msg = "unknown error"; // Just in case.
+ if (slice != NULL) {
+ if (!grpc_error_get_str(found_error, GRPC_ERROR_STR_GRPC_MESSAGE, slice)) {
+ if (!grpc_error_get_str(found_error, GRPC_ERROR_STR_DESCRIPTION, slice)) {
+ *slice = grpc_slice_from_static_string("unknown error");
+ }
}
}