aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/transport/error_utils.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-16 19:31:28 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-16 19:31:28 -0800
commit177039b2f89e73ad0d048da021f939f3a153c4e2 (patch)
treec7f10f04cd9a0872863e2b181162bc9928160cd8 /src/core/lib/transport/error_utils.cc
parent995aa91bbbc68deb6dfd7c667cfee3af2bedec08 (diff)
parent82c8f945302f128495e261b853ac49f1dfbe69a1 (diff)
Merge master
Diffstat (limited to 'src/core/lib/transport/error_utils.cc')
-rw-r--r--src/core/lib/transport/error_utils.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/lib/transport/error_utils.cc b/src/core/lib/transport/error_utils.cc
index eb7cf192d8..2db87b5d29 100644
--- a/src/core/lib/transport/error_utils.cc
+++ b/src/core/lib/transport/error_utils.cc
@@ -24,10 +24,10 @@
static grpc_error* recursively_find_error_with_field(grpc_error* error,
grpc_error_ints which) {
// If the error itself has a status code, return it.
- if (grpc_error_get_int(error, which, NULL)) {
+ if (grpc_error_get_int(error, which, nullptr)) {
return error;
}
- if (grpc_error_is_special(error)) return NULL;
+ if (grpc_error_is_special(error)) return nullptr;
// Otherwise, search through its children.
uint8_t slot = error->first_err;
while (slot != UINT8_MAX) {
@@ -36,7 +36,7 @@ static grpc_error* recursively_find_error_with_field(grpc_error* error,
if (result) return result;
slot = lerr->next;
}
- return NULL;
+ return nullptr;
}
void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
@@ -46,7 +46,7 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
// until we find the first one that has a status code.
grpc_error* found_error =
recursively_find_error_with_field(error, GRPC_ERROR_INT_GRPC_STATUS);
- if (found_error == NULL) {
+ if (found_error == nullptr) {
/// If no grpc-status exists, retry through the tree to find a http2 error
/// code
found_error =
@@ -55,7 +55,7 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
// If we found an error with a status code above, use that; otherwise,
// fall back to using the parent error.
- if (found_error == NULL) found_error = error;
+ if (found_error == nullptr) found_error = error;
grpc_status_code status = GRPC_STATUS_UNKNOWN;
intptr_t integer;
@@ -66,9 +66,9 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
status = grpc_http2_error_to_grpc_status((grpc_http2_error_code)integer,
deadline);
}
- if (code != NULL) *code = status;
+ if (code != nullptr) *code = status;
- if (http_error != NULL) {
+ if (http_error != nullptr) {
if (grpc_error_get_int(found_error, GRPC_ERROR_INT_HTTP2_ERROR, &integer)) {
*http_error = (grpc_http2_error_code)integer;
} else if (grpc_error_get_int(found_error, GRPC_ERROR_INT_GRPC_STATUS,
@@ -82,19 +82,17 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
// If the error has a status message, use it. Otherwise, fall back to
// the error description.
- if (slice != NULL) {
+ if (slice != nullptr) {
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");
}
}
}
-
- if (found_error == NULL) found_error = error;
}
bool grpc_error_has_clear_grpc_status(grpc_error* error) {
- if (grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, NULL)) {
+ if (grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, nullptr)) {
return true;
}
uint8_t slot = error->first_err;