aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-08-21 10:11:53 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2018-08-21 10:11:53 -0700
commit85ff14dd16524b408bd30eb76d790be126aebb90 (patch)
treef3e3c03b29b004e9fda9aed62bf2cb42f0d88004 /src/core/lib/iomgr
parentb91d96bd573ac996cac26d5d6eb1ad68ff83e9e8 (diff)
Modify existing error child manipulation
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r--src/core/lib/iomgr/error.cc16
-rw-r--r--src/core/lib/iomgr/error.h6
2 files changed, 6 insertions, 16 deletions
diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc
index 226b44c46d..dfd063a695 100644
--- a/src/core/lib/iomgr/error.cc
+++ b/src/core/lib/iomgr/error.cc
@@ -513,22 +513,18 @@ bool grpc_error_get_str(grpc_error* err, grpc_error_strs which,
grpc_error* grpc_error_add_child(grpc_error* src, grpc_error* child) {
GPR_TIMER_SCOPE("grpc_error_add_child", 0);
- grpc_error* new_err = copy_error_and_unref(src);
- internal_add_error(&new_err, child);
- return new_err;
-}
-
-grpc_error* grpc_error_maybe_add_child(grpc_error* src, grpc_error* child) {
if (src != GRPC_ERROR_NONE) {
if (child == GRPC_ERROR_NONE) {
- return GRPC_ERROR_REF(src);
+ return src;
} else if (child != src) {
- return grpc_error_add_child(src, GRPC_ERROR_REF(child));
+ grpc_error* new_err = copy_error_and_unref(src);
+ internal_add_error(&new_err, child);
+ return new_err;
} else {
- return GRPC_ERROR_REF(src);
+ return src;
}
} else {
- return GRPC_ERROR_REF(child);
+ return child;
}
}
diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h
index 4f65c447fd..e5369695c9 100644
--- a/src/core/lib/iomgr/error.h
+++ b/src/core/lib/iomgr/error.h
@@ -187,12 +187,6 @@ bool grpc_error_get_str(grpc_error* error, grpc_error_strs which,
/// child error.
grpc_error* grpc_error_add_child(grpc_error* src,
grpc_error* child) GRPC_MUST_USE_RESULT;
-/// Produce an error that is a combination of both src and child.
-// If src or child, is GRPC_ERROR_NONE, a new reference to the other error is
-// returned. Otherwise, a new error with src as the parent and child as the
-// child is returned.
-grpc_error* grpc_error_maybe_add_child(grpc_error* src,
- grpc_error* child) GRPC_MUST_USE_RESULT;
grpc_error* grpc_os_error(const char* file, int line, int err,
const char* call_name) GRPC_MUST_USE_RESULT;