Deprecated grpc_error_std_string (#31267)

pull/31168/head
Esun Kim 2 years ago committed by GitHub
parent 1f798e899a
commit 85794d4094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      BUILD
  2. 44
      src/core/ext/filters/client_channel/client_channel.cc
  3. 3
      src/core/ext/filters/client_channel/dynamic_filters.cc
  4. 3
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  5. 7
      src/core/ext/filters/client_channel/lb_policy/rls/rls.cc
  6. 3
      src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc
  7. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  8. 6
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
  9. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  10. 8
      src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc
  11. 3
      src/core/ext/filters/client_channel/resolver/polling_resolver.cc
  12. 5
      src/core/ext/filters/client_channel/resolver_result_parsing.cc
  13. 17
      src/core/ext/filters/client_channel/retry_filter.cc
  14. 11
      src/core/ext/filters/client_channel/retry_service_config.cc
  15. 7
      src/core/ext/filters/client_channel/subchannel.cc
  16. 3
      src/core/ext/filters/client_channel/subchannel_stream_client.cc
  17. 3
      src/core/ext/filters/fault_injection/service_config_parser.cc
  18. 2
      src/core/ext/filters/message_size/message_size_filter.cc
  19. 6
      src/core/ext/filters/rbac/rbac_service_config_parser.cc
  20. 3
      src/core/ext/filters/server_config_selector/server_config_selector_filter.cc
  21. 15
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  22. 10
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  23. 2
      src/core/ext/transport/chttp2/transport/parsing.cc
  24. 32
      src/core/ext/transport/inproc/inproc_transport.cc
  25. 3
      src/core/ext/xds/certificate_provider_store.cc
  26. 5
      src/core/lib/address_utils/parse_address.cc
  27. 3
      src/core/lib/channel/connected_channel.cc
  28. 2
      src/core/lib/channel/promise_based_filter.cc
  29. 4
      src/core/lib/iomgr/call_combiner.cc
  30. 3
      src/core/lib/iomgr/call_combiner.h
  31. 10
      src/core/lib/iomgr/endpoint_cfstream.cc
  32. 2
      src/core/lib/iomgr/error.h
  33. 2
      src/core/lib/iomgr/lockfree_event.cc
  34. 4
      src/core/lib/iomgr/tcp_client_cfstream.cc
  35. 4
      src/core/lib/iomgr/tcp_client_posix.cc
  36. 12
      src/core/lib/iomgr/tcp_posix.cc
  37. 4
      src/core/lib/iomgr/tcp_server_posix.cc
  38. 2
      src/core/lib/iomgr/tcp_server_windows.cc
  39. 4
      src/core/lib/security/authorization/grpc_authorization_policy_provider.cc
  40. 3
      src/core/lib/security/credentials/external/external_account_credentials.cc
  41. 2
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  42. 4
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  43. 9
      src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc
  44. 13
      src/core/lib/security/security_connector/tls/tls_security_connector.cc
  45. 3
      src/core/lib/security/transport/security_handshaker.cc
  46. 2
      src/core/lib/surface/call.cc
  47. 15
      src/core/lib/surface/completion_queue.cc
  48. 2
      src/core/lib/surface/server.cc
  49. 4
      src/core/lib/transport/error_utils.cc
  50. 5
      src/core/lib/transport/handshaker.cc
  51. 9
      src/core/lib/transport/transport_op_string.cc
  52. 2
      src/core/tsi/alts/handshaker/alts_handshaker_client.cc
  53. 2
      src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
  54. 4
      src/core/tsi/ssl/key_logging/ssl_key_logging.cc
  55. 5
      src/cpp/client/secure_credentials.cc
  56. 3
      test/core/channel/channel_stack_test.cc
  57. 2
      test/core/end2end/BUILD
  58. 3
      test/core/end2end/bad_server_response_test.cc
  59. 5
      test/core/end2end/fixtures/http_proxy_fixture.cc
  60. 5
      test/core/http/httpcli_test.cc
  61. 5
      test/core/http/httpscli_test.cc
  62. 2
      test/core/iomgr/error_test.cc
  63. 2
      test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm
  64. 2
      test/core/iomgr/tcp_server_posix_test.cc
  65. 4
      test/core/security/credentials_test.cc
  66. 2
      test/core/security/print_google_default_creds_token.cc
  67. 2
      test/core/transport/binder/binder_transport_test.cc
  68. 3
      test/core/transport/chttp2/hpack_parser_test.cc
  69. 4
      test/core/transport/chttp2/settings_timeout_test.cc
  70. 3
      test/core/util/BUILD
  71. 6
      test/core/util/fake_udp_and_tcp_server.cc
  72. 3
      test/core/util/port_server_client.cc
  73. 4
      test/core/util/test_lb_policies.cc
  74. 17
      test/core/xds/file_watcher_certificate_provider_factory_test.cc
  75. 17
      test/core/xds/google_mesh_ca_certificate_provider_factory_test.cc
  76. 57
      test/core/xds/xds_certificate_provider_test.cc

14
BUILD

@ -1846,6 +1846,7 @@ grpc_cc_library(
"ref_counted_ptr",
"slice",
"slice_buffer",
"status_helper",
"time",
],
)
@ -4068,6 +4069,7 @@ grpc_cc_library(
"grpc_service_config",
"promise",
"ref_counted_ptr",
"status_helper",
],
)
@ -4270,6 +4272,7 @@ grpc_cc_library(
"json_util",
"service_config_parser",
"sleep",
"status_helper",
"time",
"try_seq",
],
@ -4451,6 +4454,7 @@ grpc_cc_library(
"slice",
"slice_refcount",
"sockaddr_utils",
"status_helper",
"subchannel_interface",
"time",
"uri_parser",
@ -4514,6 +4518,7 @@ grpc_cc_library(
"server_address",
"slice",
"slice_refcount",
"status_helper",
"subchannel_interface",
"time",
"uri_parser",
@ -5591,6 +5596,7 @@ grpc_cc_library(
"iomgr_timer",
"orphanable",
"ref_counted_ptr",
"status_helper",
"time",
"uri_parser",
"work_serializer",
@ -5744,6 +5750,7 @@ grpc_cc_library(
"orphanable",
"resolved_address",
"server_address",
"status_helper",
"uri_parser",
],
)
@ -5870,6 +5877,7 @@ grpc_cc_library(
"orphanable",
"ref_counted_ptr",
"resource_quota",
"status_helper",
"time",
"uri_parser",
"work_serializer",
@ -6289,6 +6297,7 @@ grpc_cc_library(
"ref_counted_ptr",
"slice",
"slice_refcount",
"status_helper",
"tsi_base",
"tsi_ssl_credentials",
"tsi_ssl_session_cache",
@ -6411,6 +6420,7 @@ grpc_cc_library(
"ref_counted_ptr",
"slice",
"slice_refcount",
"status_helper",
"time",
"unique_type_name",
"uri_parser",
@ -6458,6 +6468,7 @@ grpc_cc_library(
"ref_counted_ptr",
"slice",
"slice_refcount",
"status_helper",
"time",
"uri_parser",
],
@ -6844,6 +6855,7 @@ grpc_cc_library(
"ref_counted_ptr",
"slice",
"slice_refcount",
"status_helper",
"useful",
],
)
@ -7170,6 +7182,7 @@ grpc_cc_library(
"resolved_address",
"resource_quota",
"sockaddr_utils",
"status_helper",
"time",
"transport_fwd",
"unique_type_name",
@ -7349,6 +7362,7 @@ grpc_cc_library(
"slice",
"slice_buffer",
"slice_refcount",
"status_helper",
"thread_quota",
"time",
"useful",

@ -1695,7 +1695,7 @@ void ClientChannel::StartTransportOpLocked(grpc_transport_op* op) {
if (!op->disconnect_with_error.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", this,
grpc_error_std_string(op->disconnect_with_error).c_str());
StatusToString(op->disconnect_with_error).c_str());
}
DestroyResolverAndLbPolicyLocked();
intptr_t value;
@ -1906,8 +1906,7 @@ void ClientChannel::CallData::StartTransportStreamOpBatch(
if (GPR_UNLIKELY(!calld->cancel_error_.ok())) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: failing batch with error: %s",
chand, calld,
grpc_error_std_string(calld->cancel_error_).c_str());
chand, calld, StatusToString(calld->cancel_error_).c_str());
}
// Note: This will release the call combiner.
grpc_transport_stream_op_batch_finish_with_failure(
@ -1924,7 +1923,7 @@ void ClientChannel::CallData::StartTransportStreamOpBatch(
calld->cancel_error_ = batch->payload->cancel_stream.cancel_error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: recording cancel_error=%s", chand,
calld, grpc_error_std_string(calld->cancel_error_).c_str());
calld, StatusToString(calld->cancel_error_).c_str());
}
// Fail all pending batches.
calld->PendingBatchesFail(elem, calld->cancel_error_, NoYieldCallCombiner);
@ -2018,10 +2017,9 @@ void ClientChannel::CallData::PendingBatchesFail(
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
if (pending_batches_[i] != nullptr) ++num_batches;
}
gpr_log(GPR_INFO,
"chand=%p calld=%p: failing %" PRIuPTR " pending batches: %s",
elem->channel_data, this, num_batches,
grpc_error_std_string(error).c_str());
gpr_log(
GPR_INFO, "chand=%p calld=%p: failing %" PRIuPTR " pending batches: %s",
elem->channel_data, this, num_batches, StatusToString(error).c_str());
}
CallCombinerClosureList closures;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
@ -2112,7 +2110,7 @@ class ClientChannel::CallData::ResolverQueuedCallCanceller {
gpr_log(GPR_INFO,
"chand=%p calld=%p: cancelling resolver queued pick: "
"error=%s self=%p calld->resolver_pick_canceller=%p",
chand, calld, grpc_error_std_string(error).c_str(), self,
chand, calld, StatusToString(error).c_str(), self,
calld->resolver_call_canceller_);
}
if (calld->resolver_call_canceller_ == self && !error.ok()) {
@ -2234,7 +2232,7 @@ void ClientChannel::CallData::
gpr_log(GPR_INFO,
"chand=%p calld=%p: got recv_trailing_metadata_ready: error=%s "
"service_config_call_data=%p",
chand, calld, grpc_error_std_string(error).c_str(),
chand, calld, StatusToString(error).c_str(),
service_config_call_data);
}
if (service_config_call_data != nullptr) {
@ -2261,7 +2259,7 @@ void ClientChannel::CallData::ResolutionDone(void* arg,
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: error applying config to call: error=%s",
chand, calld, grpc_error_std_string(error).c_str());
chand, calld, StatusToString(error).c_str());
}
calld->PendingBatchesFail(elem, error, YieldCallCombiner);
return;
@ -2377,7 +2375,7 @@ void ClientChannel::CallData::CreateDynamicCall(grpc_call_element* elem) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: failed to create dynamic call: error=%s",
chand, this, grpc_error_std_string(error).c_str());
chand, this, StatusToString(error).c_str());
}
PendingBatchesFail(elem, error, YieldCallCombiner);
return;
@ -2640,7 +2638,7 @@ void ClientChannel::LoadBalancedCall::PendingBatchesFail(
}
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: failing %" PRIuPTR " pending batches: %s",
chand_, this, num_batches, grpc_error_std_string(error).c_str());
chand_, this, num_batches, StatusToString(error).c_str());
}
CallCombinerClosureList closures;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
@ -2788,7 +2786,7 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
if (GPR_UNLIKELY(!cancel_error_.ok())) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: failing batch with error: %s",
chand_, this, grpc_error_std_string(cancel_error_).c_str());
chand_, this, StatusToString(cancel_error_).c_str());
}
// Note: This will release the call combiner.
grpc_transport_stream_op_batch_finish_with_failure(batch, cancel_error_,
@ -2805,7 +2803,7 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
cancel_error_ = batch->payload->cancel_stream.cancel_error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: recording cancel_error=%s",
chand_, this, grpc_error_std_string(cancel_error_).c_str());
chand_, this, StatusToString(cancel_error_).c_str());
}
// Fail all pending batches.
PendingBatchesFail(cancel_error_, NoYieldCallCombiner);
@ -2844,7 +2842,7 @@ void ClientChannel::LoadBalancedCall::SendInitialMetadataOnComplete(
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: got on_complete for send_initial_metadata: "
"error=%s",
self->chand_, self, grpc_error_std_string(error).c_str());
self->chand_, self, StatusToString(error).c_str());
}
self->call_attempt_tracer_->RecordOnDoneSendInitialMetadata(
self->peer_string_);
@ -2858,7 +2856,7 @@ void ClientChannel::LoadBalancedCall::RecvInitialMetadataReady(
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: got recv_initial_metadata_ready: error=%s",
self->chand_, self, grpc_error_std_string(error).c_str());
self->chand_, self, StatusToString(error).c_str());
}
if (error.ok()) {
// recv_initial_metadata_flags is not populated for clients
@ -2874,7 +2872,7 @@ void ClientChannel::LoadBalancedCall::RecvMessageReady(
auto* self = static_cast<LoadBalancedCall*>(arg);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: got recv_message_ready: error=%s",
self->chand_, self, grpc_error_std_string(error).c_str());
self->chand_, self, StatusToString(error).c_str());
}
if (self->recv_message_->has_value()) {
self->call_attempt_tracer_->RecordReceivedMessage(**self->recv_message_);
@ -2890,9 +2888,9 @@ void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
"chand=%p lb_call=%p: got recv_trailing_metadata_ready: error=%s "
"call_attempt_tracer_=%p lb_subchannel_call_tracker_=%p "
"failure_error_=%s",
self->chand_, self, grpc_error_std_string(error).c_str(),
self->chand_, self, StatusToString(error).c_str(),
self->call_attempt_tracer_, self->lb_subchannel_call_tracker_.get(),
grpc_error_std_string(self->failure_error_).c_str());
StatusToString(self->failure_error_).c_str());
}
// Check if we have a tracer or an LB callback to invoke.
if (self->call_attempt_tracer_ != nullptr ||
@ -2961,7 +2959,7 @@ void ClientChannel::LoadBalancedCall::CreateSubchannelCall() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: create subchannel_call=%p: error=%s", chand_,
this, subchannel_call_.get(), grpc_error_std_string(error).c_str());
this, subchannel_call_.get(), StatusToString(error).c_str());
}
if (on_call_destruction_complete_ != nullptr) {
subchannel_call_->SetAfterCallStackDestroy(on_call_destruction_complete_);
@ -3001,7 +2999,7 @@ class ClientChannel::LoadBalancedCall::LbQueuedCallCanceller {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: cancelling queued pick: "
"error=%s self=%p calld->pick_canceller=%p",
chand, lb_call, grpc_error_std_string(error).c_str(), self,
chand, lb_call, StatusToString(error).c_str(), self,
lb_call->lb_call_canceller_);
}
if (lb_call->lb_call_canceller_ == self && !error.ok()) {
@ -3059,7 +3057,7 @@ void ClientChannel::LoadBalancedCall::PickDone(void* arg,
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: failed to pick subchannel: error=%s",
self->chand_, self, grpc_error_std_string(error).c_str());
self->chand_, self, StatusToString(error).c_str());
}
self->PendingBatchesFail(error, YieldCallCombiner);
return;

@ -33,6 +33,7 @@
#include "src/core/lib/channel/channel_stack_builder_impl.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/surface/lame_client.h"
@ -67,7 +68,7 @@ DynamicFilters::Call::Call(Args args, grpc_error_handle* error)
*error = grpc_call_stack_init(channel_stack_->channel_stack_.get(), 1,
Destroy, this, &call_args);
if (GPR_UNLIKELY(!error->ok())) {
gpr_log(GPR_ERROR, "error: %s", grpc_error_std_string(*error).c_str());
gpr_log(GPR_ERROR, "error: %s", StatusToString(*error).c_str());
return;
}
grpc_call_stack_set_pollset_or_pollset_set(call_stack, args.pollent);

@ -112,6 +112,7 @@
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/validation_errors.h"
#include "src/core/lib/gprpp/work_serializer.h"
@ -1325,7 +1326,7 @@ void GrpcLb::BalancerCallState::OnBalancerStatusReceivedLocked(
"[grpclb %p] lb_calld=%p: Status from LB server received. "
"Status = %d, details = '%s', (lb_call: %p), error '%s'",
grpclb_policy(), this, lb_call_status_, status_details, lb_call_,
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
gpr_free(status_details);
}
// If this lb_calld is still in use, this call ended because of a failure so

@ -72,6 +72,7 @@
#include "src/core/lib/gprpp/dual_ref_counted.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/validation_errors.h"
@ -1421,7 +1422,7 @@ void RlsLb::Cache::OnCleanupTimer(void* arg, grpc_error_handle error) {
RefCountedPtr<RlsLb> lb_policy(cache->lb_policy_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_rls_trace)) {
gpr_log(GPR_INFO, "[rlslb %p] cache cleanup timer fired (%s)",
cache->lb_policy_, grpc_error_std_string(error).c_str());
cache->lb_policy_, StatusToString(error).c_str());
}
if (error == absl::CancelledError()) return;
MutexLock lock(&lb_policy->mu_);
@ -1767,7 +1768,7 @@ void RlsLb::RlsRequest::OnRlsCallCompleteLocked(grpc_error_handle error) {
"[rlslb %p] rls_request=%p %s, error=%s, status={%d, %s} RLS call "
"response received",
lb_policy_.get(), this, key_.ToString().c_str(),
grpc_error_std_string(error).c_str(), status_recv_,
StatusToString(error).c_str(), status_recv_,
status_message.c_str());
}
// Parse response.
@ -2423,7 +2424,7 @@ void RlsLbConfig::JsonPostLoad(const Json& json, const JsonArgs&,
auto service_config = MakeRefCounted<ServiceConfigImpl>(
ChannelArgs(), rls_channel_service_config_, it->second, &child_error);
if (!child_error.ok()) {
errors->AddError(grpc_error_std_string(child_error));
errors->AddError(StatusToString(child_error));
}
}
// Validate childPolicyConfigTargetFieldName.

@ -18,6 +18,7 @@
#include "absl/status/status.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/port.h" // IWYU pragma: keep
#ifdef GRPC_HAVE_UNIX_SOCKET
@ -126,7 +127,7 @@ class BinderResolverFactory : public ResolverFactory {
}
grpc_error_handle error = BinderAddrPopulate(uri.path(), &addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(error).c_str());
gpr_log(GPR_ERROR, "%s", StatusToString(error).c_str());
return false;
}
}

@ -413,7 +413,7 @@ AresClientChannelDNSResolver::AresRequestWrapper::OnResolvedLocked(
if (!service_config_error.ok()) {
result.service_config = absl::UnavailableError(
absl::StrCat("failed to parse service config: ",
grpc_error_std_string(service_config_error)));
StatusToString(service_config_error)));
} else if (!service_config_string.empty()) {
GRPC_CARES_TRACE_LOG("resolver:%p selected service config choice: %s",
this, service_config_string.c_str());
@ -432,7 +432,7 @@ AresClientChannelDNSResolver::AresRequestWrapper::OnResolvedLocked(
}
} else {
GRPC_CARES_TRACE_LOG("resolver:%p dns resolution failed: %s", this,
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
std::string error_message;
grpc_error_get_str(error, StatusStrProperty::kDescription, &error_message);
absl::Status status = absl::UnavailableError(

@ -430,7 +430,7 @@ class GrpcPolledFdWindows {
"fd:%s InnerOnTcpConnectLocked error:|%s| "
"pending_register_for_readable:%d"
" pending_register_for_writeable:%d",
GetName(), grpc_error_std_string(error).c_str(),
GetName(), StatusToString(error).c_str(),
pending_continue_register_for_on_readable_locked_,
pending_continue_register_for_on_writeable_locked_);
GPR_ASSERT(!connect_done_);
@ -592,7 +592,7 @@ class GrpcPolledFdWindows {
"fd:|%s| OnIocpReadableInner winsocket_->read_info.wsa_error "
"code:|%d| msg:|%s|",
GetName(), winsocket_->read_info.wsa_error,
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
}
}
@ -627,7 +627,7 @@ class GrpcPolledFdWindows {
"fd:|%s| OnIocpWriteableInner. winsocket_->write_info.wsa_error "
"code:|%d| msg:|%s|",
GetName(), winsocket_->write_info.wsa_error,
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
}
GPR_ASSERT(tcp_write_state_ == WRITE_PENDING);

@ -293,7 +293,7 @@ static void on_timeout(void* arg, grpc_error_handle error) {
"request:%p ev_driver=%p on_timeout_locked. driver->shutting_down=%d. "
"err=%s",
driver->request, driver, driver->shutting_down,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
if (!driver->shutting_down && error.ok()) {
grpc_ares_ev_driver_shutdown_locked(driver);
}
@ -319,7 +319,7 @@ static void on_ares_backup_poll_alarm(void* arg, grpc_error_handle error) {
"driver->shutting_down=%d. "
"err=%s",
driver->request, driver, driver->shutting_down,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
if (!driver->shutting_down && error.ok()) {
fd_node* fdn = driver->fds;
while (fdn != nullptr) {

@ -45,6 +45,7 @@
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/work_serializer.h"
#include "src/core/lib/http/httpcli.h"
@ -211,9 +212,8 @@ void GoogleCloud2ProdResolver::ZoneQuery::OnDone(
grpc_error_handle error) {
absl::StatusOr<std::string> zone;
if (!error.ok()) {
zone = absl::UnknownError(
absl::StrCat("error fetching zone from metadata server: ",
grpc_error_std_string(error)));
zone = absl::UnknownError(absl::StrCat(
"error fetching zone from metadata server: ", StatusToString(error)));
} else if (response->status != 200) {
zone = absl::UnknownError(absl::StrFormat(
"zone query received non-200 status: %d", response->status));
@ -252,7 +252,7 @@ void GoogleCloud2ProdResolver::IPv6Query::OnDone(
grpc_error_handle error) {
if (!error.ok()) {
gpr_log(GPR_ERROR, "error fetching IPv6 address from metadata server: %s",
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
resolver->IPv6QueryDone(error.ok() && response->status == 200);
}

@ -36,6 +36,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/work_serializer.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/timer.h"
@ -115,7 +116,7 @@ void PollingResolver::OnNextResolutionLocked(grpc_error_handle error) {
gpr_log(GPR_INFO,
"[polling resolver %p] re-resolution timer fired: error=\"%s\", "
"shutdown_=%d",
this, grpc_error_std_string(error).c_str(), shutdown_);
this, StatusToString(error).c_str(), shutdown_);
}
have_next_resolution_timer_ = false;
if (error.ok() && !shutdown_) {

@ -31,6 +31,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/json/json_util.h"
#include "src/core/lib/load_balancing/lb_policy_registry.h"
@ -139,7 +140,7 @@ ClientChannelServiceConfigParser::ParseGlobalParams(const ChannelArgs& /*args*/,
"Client channel global parser", &error_list);
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("error parsing client channel global parameters: ",
grpc_error_std_string(error)));
StatusToString(error)));
return status;
}
return std::make_unique<ClientChannelGlobalParsedConfig>(
@ -174,7 +175,7 @@ ClientChannelServiceConfigParser::ParsePerMethodParams(
GRPC_ERROR_CREATE_FROM_VECTOR("Client channel parser", &error_list);
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("error parsing client channel method parameters: ",
grpc_error_std_string(error)));
StatusToString(error)));
return status;
}
return std::make_unique<ClientChannelMethodParsedConfig>(timeout,

@ -1270,8 +1270,7 @@ void RetryFilter::CallData::CallAttempt::OnPerAttemptRecvTimerLocked(
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: perAttemptRecvTimeout timer fired: "
"error=%s, per_attempt_recv_timer_pending_=%d",
calld->chand_, calld, call_attempt,
grpc_error_std_string(error).c_str(),
calld->chand_, calld, call_attempt, StatusToString(error).c_str(),
call_attempt->per_attempt_recv_timer_pending_);
}
CallCombinerClosureList closures;
@ -1426,7 +1425,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvInitialMetadataReady(
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got recv_initial_metadata_ready, error=%s",
calld->chand_, calld, call_attempt, batch_data.get(),
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
call_attempt->completed_recv_initial_metadata_ = true;
// If this attempt has been abandoned, then we're not going to use the
@ -1525,7 +1524,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvMessageReady(
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got recv_message_ready, error=%s",
calld->chand_, calld, call_attempt, batch_data.get(),
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
++call_attempt->completed_recv_message_count_;
// If this attempt has been abandoned, then we're not going to use the
@ -1719,7 +1718,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvTrailingMetadataReady(
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got recv_trailing_metadata_ready, error=%s",
calld->chand_, calld, call_attempt, batch_data.get(),
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
call_attempt->completed_recv_trailing_metadata_ = true;
// If this attempt has been abandoned, then we're not going to use the
@ -1882,7 +1881,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::OnComplete(
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got on_complete, error=%s, batch=%s",
calld->chand_, calld, call_attempt, batch_data.get(),
grpc_error_std_string(error).c_str(),
StatusToString(error).c_str(),
grpc_transport_stream_op_batch_string(&batch_data->batch_).c_str());
}
// If this attempt has been abandoned, then we're not going to propagate
@ -1957,7 +1956,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::OnCompleteForCancelOp(
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got on_complete for cancel_stream batch, error=%s, batch=%s",
calld->chand_, calld, call_attempt, batch_data.get(),
grpc_error_std_string(error).c_str(),
StatusToString(error).c_str(),
grpc_transport_stream_op_batch_string(&batch_data->batch_).c_str());
}
GRPC_CALL_COMBINER_STOP(
@ -2204,7 +2203,7 @@ void RetryFilter::CallData::StartTransportStreamOpBatch(
cancelled_from_surface_ = batch->payload->cancel_stream.cancel_error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: cancelled from surface: %s", chand_,
this, grpc_error_std_string(cancelled_from_surface_).c_str());
this, StatusToString(cancelled_from_surface_).c_str());
}
// Fail any pending batches.
PendingBatchesFail(cancelled_from_surface_);
@ -2509,7 +2508,7 @@ void RetryFilter::CallData::PendingBatchesFail(grpc_error_handle error) {
}
gpr_log(GPR_INFO,
"chand=%p calld=%p: failing %" PRIuPTR " pending batches: %s",
chand_, this, num_batches, grpc_error_std_string(error).c_str());
chand_, this, num_batches, StatusToString(error).c_str());
}
CallCombinerClosureList closures;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {

@ -39,6 +39,7 @@
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/json/json_util.h"
@ -150,9 +151,8 @@ RetryServiceConfigParser::ParseGlobalParams(const ChannelArgs& /*args*/,
grpc_error_handle error =
ParseRetryThrottling(it->second, &max_milli_tokens, &milli_token_ratio);
if (!error.ok()) {
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("error parsing retry global parameters: ",
grpc_error_std_string(error)));
absl::Status status = absl::InvalidArgumentError(absl::StrCat(
"error parsing retry global parameters: ", StatusToString(error)));
return status;
}
return std::make_unique<RetryGlobalConfig>(max_milli_tokens,
@ -307,9 +307,8 @@ RetryServiceConfigParser::ParsePerMethodParams(const ChannelArgs& args,
args, it->second, &max_attempts, &initial_backoff, &max_backoff,
&backoff_multiplier, &retryable_status_codes, &per_attempt_recv_timeout);
if (!error.ok()) {
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("error parsing retry method parameters: ",
grpc_error_std_string(error)));
absl::Status status = absl::InvalidArgumentError(absl::StrCat(
"error parsing retry method parameters: ", StatusToString(error)));
return status;
}
return std::make_unique<RetryMethodConfig>(

@ -55,6 +55,7 @@
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/handshaker/proxy_mapper_registry.h"
#include "src/core/lib/iomgr/exec_ctx.h"
@ -160,7 +161,7 @@ SubchannelCall::SubchannelCall(Args args, grpc_error_handle* error)
*error = grpc_call_stack_init(connected_subchannel_->channel_stack(), 1,
SubchannelCall::Destroy, this, &call_args);
if (GPR_UNLIKELY(!error->ok())) {
gpr_log(GPR_ERROR, "error: %s", grpc_error_std_string(*error).c_str());
gpr_log(GPR_ERROR, "error: %s", StatusToString(*error).c_str());
return;
}
grpc_call_stack_set_pollset_or_pollset_set(callstk, args.pollent);
@ -906,7 +907,7 @@ void Subchannel::OnConnectingFinishedLocked(grpc_error_handle error) {
gpr_log(GPR_INFO,
"subchannel %p %s: connect failed (%s), backing off for %" PRId64
" ms",
this, key_.ToString().c_str(), grpc_error_std_string(error).c_str(),
this, key_.ToString().c_str(), StatusToString(error).c_str(),
time_until_next_attempt.millis());
SetConnectivityStateLocked(GRPC_CHANNEL_TRANSIENT_FAILURE,
grpc_error_to_absl_status(error));
@ -943,7 +944,7 @@ bool Subchannel::PublishTransportLocked() {
grpc_transport_destroy(connecting_result_.transport);
gpr_log(GPR_ERROR,
"subchannel %p %s: error initializing subchannel stack: %s", this,
key_.ToString().c_str(), grpc_error_std_string(error).c_str());
key_.ToString().c_str(), StatusToString(error).c_str());
return false;
}
RefCountedPtr<channelz::SocketNode> socket =

@ -30,6 +30,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/resource_quota/resource_quota.h"
@ -223,7 +224,7 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
"SubchannelStreamClient %p CallState %p: error creating "
"stream on subchannel (%s); will retry",
subchannel_stream_client_.get(), this,
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
CallEndedLocked(/*retry=*/true);
return;
}

@ -28,6 +28,7 @@
#include "src/core/ext/filters/fault_injection/fault_injection_filter.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/json/json_util.h"
@ -163,7 +164,7 @@ FaultInjectionServiceConfigParser::ParsePerMethodParams(const ChannelArgs& args,
GRPC_ERROR_CREATE_FROM_VECTOR("Fault injection parser", &error_list);
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("error parsing fault injection method parameters: ",
grpc_error_std_string(error)));
StatusToString(error)));
return status;
}
if (fault_injection_policies.empty()) return nullptr;

@ -118,7 +118,7 @@ MessageSizeParser::ParsePerMethodParams(const ChannelArgs& /*args*/,
GRPC_ERROR_CREATE_FROM_VECTOR("Message size parser", &error_list);
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("error parsing message size method parameters: ",
grpc_error_std_string(error)));
StatusToString(error)));
return status;
}
return std::make_unique<MessageSizeParsedConfig>(max_request_message_bytes,

@ -30,6 +30,7 @@
#include "absl/types/optional.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/json/json_util.h"
#include "src/core/lib/matchers/matchers.h"
@ -594,9 +595,8 @@ RbacServiceConfigParser::ParsePerMethodParams(const ChannelArgs& args,
grpc_error_handle error =
GRPC_ERROR_CREATE_FROM_VECTOR("Rbac parser", &error_list);
if (!error.ok()) {
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("error parsing RBAC method parameters: ",
grpc_error_std_string(error)));
absl::Status status = absl::InvalidArgumentError(absl::StrCat(
"error parsing RBAC method parameters: ", StatusToString(error)));
return status;
}
if (rbac_policies.empty()) return nullptr;

@ -32,6 +32,7 @@
#include "src/core/lib/channel/context.h"
#include "src/core/lib/channel/promise_based_filter.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/promise/arena_promise.h"
@ -137,7 +138,7 @@ ArenaPromise<ServerMetadataHandle> ServerConfigSelectorFilter::MakeCallPromise(
sel.value()->GetCallConfig(call_args.client_initial_metadata.get());
if (!call_config.error.ok()) {
auto r = Immediate(ServerMetadataHandle(
absl::UnavailableError(grpc_error_std_string(call_config.error))));
absl::UnavailableError(StatusToString(call_config.error))));
return std::move(r);
}
auto& ctx = GetContext<

@ -58,6 +58,7 @@
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/unique_type_name.h"
@ -324,7 +325,7 @@ void Chttp2ServerListener::ConfigFetcherWatcher::UpdateConnectionManager(
listener_->tcp_server_, &listener_->resolved_address_, &port_temp);
if (!error.ok()) {
gpr_log(GPR_ERROR, "Error adding port to server: %s",
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
// TODO(yashykt): We wouldn't need to assert here if we bound to the
// port earlier during AddPort.
GPR_ASSERT(0);
@ -443,7 +444,7 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
{
MutexLock connection_lock(&self->connection_->mu_);
if (!error.ok() || self->connection_->shutdown_) {
std::string error_str = grpc_error_std_string(error);
std::string error_str = StatusToString(error);
gpr_log(GPR_DEBUG, "Handshaking failed: %s", error_str.c_str());
cleanup_connection = true;
if (error.ok() && args->endpoint != nullptr) {
@ -509,7 +510,7 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
} else {
// Failed to create channel from transport. Clean up.
gpr_log(GPR_ERROR, "Failed to create channel: %s",
grpc_error_std_string(channel_init_err).c_str());
StatusToString(channel_init_err).c_str());
grpc_transport_destroy(transport);
grpc_slice_buffer_destroy(args->read_buffer);
gpr_free(args->read_buffer);
@ -822,7 +823,7 @@ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
args = self->args_modifier_(*args_result, &error);
if (!error.ok()) {
gpr_log(GPR_DEBUG, "Closing connection: %s",
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
endpoint_cleanup(error);
return;
}
@ -965,7 +966,7 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
resolved_or->size() - error_list.size(), resolved_or->size());
error = GRPC_ERROR_CREATE_REFERENCING(msg.c_str(), error_list.data(),
error_list.size());
gpr_log(GPR_INFO, "WARNING: %s", grpc_error_std_string(error).c_str());
gpr_log(GPR_INFO, "WARNING: %s", StatusToString(error).c_str());
// we managed to bind some addresses: continue without error
}
return absl::OkStatus();
@ -1041,7 +1042,7 @@ int grpc_server_add_http2_port(grpc_server* server, const char* addr,
done:
sc.reset(DEBUG_LOCATION, "server");
if (!err.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(err).c_str());
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(err).c_str());
}
return port_num;
}
@ -1078,7 +1079,7 @@ void grpc_server_add_channel_from_fd(grpc_server* server, int fd,
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
} else {
gpr_log(GPR_ERROR, "Failed to create channel: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
grpc_transport_destroy(transport);
}
}

@ -985,7 +985,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
// received a GOAWAY with a non NO_ERROR code.
if (goaway_error != GRPC_HTTP2_NO_ERROR) {
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string.c_str(),
goaway_error, grpc_error_std_string(t->goaway_error).c_str());
goaway_error, grpc_core::StatusToString(t->goaway_error).c_str());
}
if (t->is_client) {
cancel_unstarted_streams(t, t->goaway_error);
@ -1132,7 +1132,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
CLOSURE_BARRIER_FIRST_REF_BIT),
static_cast<int>(closure->next_data.scratch %
CLOSURE_BARRIER_FIRST_REF_BIT),
desc, grpc_error_std_string(error).c_str(),
desc, grpc_core::StatusToString(error).c_str(),
write_state_name(t->write_state));
}
if (!error.ok()) {
@ -1670,7 +1670,7 @@ static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error,
t->sent_goaway_state == GRPC_CHTTP2_GRACEFUL_GOAWAY) {
// We want to log this irrespective of whether http tracing is enabled
gpr_log(GPR_DEBUG, "%s: Sending goaway err=%s", t->peer_string.c_str(),
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
t->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED;
grpc_chttp2_goaway_append(
t->last_new_stream_id, static_cast<uint32_t>(http_error),
@ -2442,7 +2442,7 @@ static void start_bdp_ping_locked(void* tp, grpc_error_handle error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
if (!error.ok() || !t->closed_with_error.ok()) {
return;
@ -2466,7 +2466,7 @@ static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
if (!error.ok() || !t->closed_with_error.ok()) {
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");

@ -715,7 +715,7 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
} else if (grpc_error_get_int(err, grpc_core::StatusIntProperty::kStreamId,
&unused)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(err).c_str());
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(err).c_str());
}
grpc_chttp2_parsing_become_skip_parser(t);
if (s) {

@ -409,7 +409,7 @@ void complete_if_batch_end_locked(inproc_stream* s, grpc_error_handle error,
if ((is_sm + is_stm + is_rim + is_rm + is_rtm) == 1) {
INPROC_LOG(GPR_INFO, "%s %p %p %s", msg, s, op,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
grpc_core::ExecCtx::Run(DEBUG_LOCATION, op->on_complete, error);
}
}
@ -476,8 +476,8 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
}
INPROC_LOG(GPR_INFO,
"fail_helper %p scheduling initial-metadata-ready %s %s", s,
grpc_error_std_string(error).c_str(),
grpc_error_std_string(err).c_str());
grpc_core::StatusToString(error).c_str(),
grpc_core::StatusToString(err).c_str());
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
s->recv_initial_md_op->payload->recv_initial_metadata
@ -492,7 +492,7 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
}
if (s->recv_message_op) {
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling message-ready %s", s,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
if (s->recv_message_op->payload->recv_message
.call_failed_before_recv_message != nullptr) {
*s->recv_message_op->payload->recv_message
@ -521,14 +521,14 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
}
if (s->recv_trailing_md_op) {
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-metadata-ready %s",
s, grpc_error_std_string(error).c_str());
s, grpc_core::StatusToString(error).c_str());
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
s->recv_trailing_md_op->payload->recv_trailing_metadata
.recv_trailing_metadata_ready,
error);
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-md-on-complete %s",
s, grpc_error_std_string(error).c_str());
s, grpc_core::StatusToString(error).c_str());
complete_if_batch_end_locked(
s, error, s->recv_trailing_md_op,
"fail_helper scheduling recv-trailing-metadata-on-complete");
@ -671,7 +671,7 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
GPR_INFO,
"op_state_machine %p scheduling on_complete errors for already "
"recvd initial md %s",
s, grpc_error_std_string(new_err).c_str());
s, grpc_core::StatusToString(new_err).c_str());
fail_helper_locked(s, new_err);
goto done;
}
@ -728,7 +728,7 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
GPR_INFO,
"op_state_machine %p scheduling on_complete errors for already "
"recvd trailing md %s",
s, grpc_error_std_string(new_err).c_str());
s, grpc_core::StatusToString(new_err).c_str());
fail_helper_locked(s, new_err);
goto done;
}
@ -797,7 +797,7 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
// because we have already sent status and the RPC is over as far as we
// are concerned.
INPROC_LOG(GPR_INFO, "op_state_machine %p scheduling trailing-md-ready %s",
s, grpc_error_std_string(new_err).c_str());
s, grpc_core::StatusToString(new_err).c_str());
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
s->recv_trailing_md_op->payload->recv_trailing_metadata
@ -855,7 +855,7 @@ done:
bool cancel_stream_locked(inproc_stream* s, grpc_error_handle error) {
bool ret = false; // was the cancel accepted
INPROC_LOG(GPR_INFO, "cancel_stream %p with %s", s,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
if (s->cancel_self_error.ok()) {
ret = true;
s->cancel_self_error = error;
@ -1050,7 +1050,7 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
INPROC_LOG(
GPR_INFO,
"perform_stream_op error %p scheduling initial-metadata-ready %s",
s, grpc_error_std_string(error).c_str());
s, grpc_core::StatusToString(error).c_str());
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
op->payload->recv_initial_metadata.recv_initial_metadata_ready,
@ -1060,7 +1060,7 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
INPROC_LOG(
GPR_INFO,
"perform_stream_op error %p scheduling recv message-ready %s", s,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
if (op->payload->recv_message.call_failed_before_recv_message !=
nullptr) {
*op->payload->recv_message.call_failed_before_recv_message = true;
@ -1073,7 +1073,7 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
INPROC_LOG(GPR_INFO,
"perform_stream_op error %p scheduling "
"trailing-metadata-ready %s",
s, grpc_error_std_string(error).c_str());
s, grpc_core::StatusToString(error).c_str());
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
op->payload->recv_trailing_metadata.recv_trailing_metadata_ready,
@ -1081,7 +1081,7 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
}
}
INPROC_LOG(GPR_INFO, "perform_stream_op %p scheduling on_complete %s", s,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_complete, error);
}
gpr_mu_unlock(mu);
@ -1239,7 +1239,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
if (!new_channel.ok()) {
GPR_ASSERT(!channel);
gpr_log(GPR_ERROR, "Failed to create client channel: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, grpc_core::StatusIntProperty::kRpcStatus,
@ -1257,7 +1257,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
} else {
GPR_ASSERT(!channel);
gpr_log(GPR_ERROR, "Failed to create server channel: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, grpc_core::StatusIntProperty::kRpcStatus,

@ -25,6 +25,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/security/certificate_provider/certificate_provider_registry.h"
@ -78,7 +79,7 @@ void CertificateProviderStore::PluginDefinition::JsonPostLoad(
config =
factory->CreateCertificateProviderConfig(config_json, &parse_error);
if (!parse_error.ok()) {
errors->AddError(grpc_error_std_string(parse_error));
errors->AddError(StatusToString(parse_error));
}
}
}

@ -36,6 +36,7 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
#include "src/core/lib/iomgr/port.h"
#include "src/core/lib/iomgr/sockaddr.h"
@ -53,7 +54,7 @@ bool grpc_parse_unix(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(error).c_str());
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
return false;
}
return true;
@ -69,7 +70,7 @@ bool grpc_parse_unix_abstract(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixAbstractSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(error).c_str());
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
return false;
}
return true;

@ -49,6 +49,7 @@
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/match.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/closure.h"
@ -570,7 +571,7 @@ class ClientStream : public Orphanable {
if (grpc_call_trace.enabled()) {
gpr_log(GPR_INFO, "%sRecvMessageBatchDone: error=%s",
recv_message_waker_.ActivityDebugTag().c_str(),
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
} else if (absl::holds_alternative<Closed>(recv_message_state_)) {
if (grpc_call_trace.enabled()) {

@ -884,7 +884,7 @@ void ClientCallData::SetStatusFromError(grpc_metadata_batch* metadata,
metadata->Set(GrpcStatusMetadata(), status_code);
metadata->Set(GrpcMessageMetadata(), Slice::FromCopiedString(status_details));
metadata->GetOrCreatePointer(GrpcStatusContext())
->emplace_back(grpc_error_std_string(error));
->emplace_back(StatusToString(error));
}
// Wakeup and poll the promise if appropriate.

@ -117,7 +117,7 @@ void CallCombiner::Start(grpc_closure* closure, grpc_error_handle error,
"==> CallCombiner::Start() [%p] closure=%p [" DEBUG_FMT_STR
"%s] error=%s",
this, closure DEBUG_FMT_ARGS, reason,
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
}
size_t prev_size =
static_cast<size_t>(gpr_atm_full_fetch_add(&size_, (gpr_atm)1));
@ -175,7 +175,7 @@ void CallCombiner::Stop(DEBUG_ARGS const char* reason) {
closure->error_data.error = 0;
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
gpr_log(GPR_INFO, " EXECUTING FROM QUEUE: closure=%p error=%s",
closure, grpc_error_std_string(error).c_str());
closure, StatusToString(error).c_str());
}
ScheduleClosure(closure, error);
break;

@ -173,8 +173,7 @@ class CallCombinerClosureList {
"CallCombinerClosureList executing closure while already "
"holding call_combiner %p: closure=%p error=%s reason=%s",
call_combiner, closures_[0].closure,
grpc_error_std_string(closures_[0].error).c_str(),
closures_[0].reason);
StatusToString(closures_[0].error).c_str(), closures_[0].reason);
}
// This will release the call combiner.
ExecCtx::Run(DEBUG_LOCATION, closures_[0].closure, closures_[0].error);

@ -117,7 +117,8 @@ static void CallReadCb(CFStreamEndpoint* ep, grpc_error_handle error) {
gpr_log(GPR_DEBUG, "CFStream endpoint:%p call_read_cb %p %p:%p", ep,
ep->read_cb, ep->read_cb->cb, ep->read_cb->cb_arg);
size_t i;
gpr_log(GPR_DEBUG, "read: error=%s", grpc_error_std_string(error).c_str());
gpr_log(GPR_DEBUG, "read: error=%s",
grpc_core::StatusToString(error).c_str());
for (i = 0; i < ep->read_slices->count; i++) {
char* dump = grpc_dump_slice(ep->read_slices->slices[i],
@ -137,7 +138,8 @@ static void CallWriteCb(CFStreamEndpoint* ep, grpc_error_handle error) {
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_DEBUG, "CFStream endpoint:%p call_write_cb %p %p:%p", ep,
ep->write_cb, ep->write_cb->cb, ep->write_cb->cb_arg);
gpr_log(GPR_DEBUG, "write: error=%s", grpc_error_std_string(error).c_str());
gpr_log(GPR_DEBUG, "write: error=%s",
grpc_core::StatusToString(error).c_str());
}
grpc_closure* cb = ep->write_cb;
ep->write_cb = nullptr;
@ -271,14 +273,14 @@ void CFStreamShutdown(grpc_endpoint* ep, grpc_error_handle why) {
CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep);
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_DEBUG, "CFStream endpoint:%p shutdown (%s)", ep_impl,
grpc_error_std_string(why).c_str());
grpc_core::StatusToString(why).c_str());
}
CFReadStreamClose(ep_impl->read_stream);
CFWriteStreamClose(ep_impl->write_stream);
ep_impl->stream_sync->Shutdown(why);
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_DEBUG, "CFStream endpoint:%p shutdown DONE (%s)", ep_impl,
grpc_error_std_string(why).c_str());
grpc_core::StatusToString(why).c_str());
}
}

@ -42,6 +42,8 @@
typedef absl::Status grpc_error_handle;
// DEPRECATED: Use grpc_core::StatusToString instead
// TODO(veblush): Remove this once migration is done
std::string grpc_error_std_string(grpc_error_handle error);
#define GRPC_ERROR_CREATE(desc) \

@ -168,7 +168,7 @@ bool LockfreeEvent::SetShutdown(grpc_error_handle shutdown_error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_DEBUG,
"LockfreeEvent::SetShutdown: %p curr=%" PRIxPTR " err=%s",
&state_, curr, grpc_error_std_string(shutdown_error).c_str());
&state_, curr, StatusToString(shutdown_error).c_str());
}
switch (curr) {
case kClosureReady:

@ -78,7 +78,7 @@ static void OnAlarm(void* arg, grpc_error_handle error) {
CFStreamConnect* connect = static_cast<CFStreamConnect*>(arg);
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_DEBUG, "CLIENT_CONNECT :%p OnAlarm, error:%s", connect,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
gpr_mu_lock(&connect->mu);
grpc_closure* closure = connect->closure;
@ -99,7 +99,7 @@ static void OnOpen(void* arg, grpc_error_handle error) {
CFStreamConnect* connect = static_cast<CFStreamConnect*>(arg);
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_DEBUG, "CLIENT_CONNECT :%p OnOpen, error:%s", connect,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
gpr_mu_lock(&connect->mu);
grpc_timer_cancel(&connect->alarm);

@ -132,7 +132,7 @@ static void tc_on_alarm(void* acp, grpc_error_handle error) {
async_connect* ac = static_cast<async_connect*>(acp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "CLIENT_CONNECT: %s: on_alarm: error=%s",
ac->addr_str.c_str(), grpc_error_std_string(error).c_str());
ac->addr_str.c_str(), grpc_core::StatusToString(error).c_str());
}
gpr_mu_lock(&ac->mu);
if (ac->fd != nullptr) {
@ -171,7 +171,7 @@ static void on_writable(void* acp, grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "CLIENT_CONNECT: %s: on_writable: error=%s",
ac->addr_str.c_str(), grpc_error_std_string(error).c_str());
ac->addr_str.c_str(), grpc_core::StatusToString(error).c_str());
}
gpr_mu_lock(&ac->mu);

@ -685,7 +685,7 @@ static void tcp_drop_uncovered_then_handle_write(void* arg,
grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "TCP:%p got_write: %s", arg,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
drop_uncovered(static_cast<grpc_tcp*>(arg));
tcp_handle_write(arg, error);
@ -814,7 +814,7 @@ static void tcp_trace_read(grpc_tcp* tcp, grpc_error_handle error)
gpr_log(GPR_INFO, "TCP:%p call_cb %p %p:%p", tcp, cb, cb->cb, cb->cb_arg);
size_t i;
gpr_log(GPR_INFO, "READ %p (peer=%s) error=%s", tcp,
tcp->peer_string.c_str(), grpc_error_std_string(error).c_str());
tcp->peer_string.c_str(), grpc_core::StatusToString(error).c_str());
if (gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
for (i = 0; i < tcp->incoming_buffer->count; i++) {
char* dump = grpc_dump_slice(tcp->incoming_buffer->slices[i],
@ -1115,7 +1115,7 @@ static void tcp_handle_read(void* arg /* grpc_tcp */, grpc_error_handle error) {
grpc_tcp* tcp = static_cast<grpc_tcp*>(arg);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "TCP:%p got_read: %s", tcp,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
tcp->read_mu.Lock();
grpc_error_handle tcp_read_error;
@ -1468,7 +1468,7 @@ static void tcp_handle_error(void* arg /* grpc_tcp */,
grpc_tcp* tcp = static_cast<grpc_tcp*>(arg);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "TCP:%p got_error: %s", tcp,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
if (!error.ok() ||
@ -1817,7 +1817,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */,
tcp->write_cb = nullptr;
tcp->current_zerocopy_send = nullptr;
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "write: %s", grpc_error_std_string(error).c_str());
gpr_log(GPR_INFO, "write: %s", grpc_core::StatusToString(error).c_str());
}
// No need to take a ref on error since tcp_flush provides a ref.
grpc_core::Closure::Run(DEBUG_LOCATION, cb, error);
@ -1885,7 +1885,7 @@ static void tcp_write(grpc_endpoint* ep, grpc_slice_buffer* buf,
notify_on_write(tcp);
} else {
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "write: %s", grpc_error_std_string(error).c_str());
gpr_log(GPR_INFO, "write: %s", grpc_core::StatusToString(error).c_str());
}
grpc_core::Closure::Run(DEBUG_LOCATION, cb, error);
}

@ -339,13 +339,13 @@ static grpc_error_handle add_wildcard_addrs_to_server(grpc_tcp_server* s,
gpr_log(GPR_INFO,
"Failed to add :: listener, "
"the environment may not support IPv6: %s",
grpc_error_std_string(v6_err).c_str());
grpc_core::StatusToString(v6_err).c_str());
}
if (!v4_err.ok()) {
gpr_log(GPR_INFO,
"Failed to add 0.0.0.0 listener, "
"the environment may not support IPv4: %s",
grpc_error_std_string(v4_err).c_str());
grpc_core::StatusToString(v4_err).c_str());
}
return absl::OkStatus();
} else {

@ -316,7 +316,7 @@ static void on_accept(void* arg, grpc_error_handle error) {
case. We only need to adjust the pending callback count */
if (!error.ok()) {
gpr_log(GPR_INFO, "Skipping on_accept due to error: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
gpr_mu_unlock(&sp->server->mu);
return;

@ -29,6 +29,7 @@
#include <grpc/support/time.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/authorization/grpc_authorization_engine.h"
@ -63,8 +64,7 @@ absl::StatusOr<std::string> ReadPolicyFromFile(absl::string_view policy_path) {
grpc_error_handle error =
grpc_load_file(std::string(policy_path).c_str(), 0, &policy_slice);
if (!error.ok()) {
absl::Status status =
absl::InvalidArgumentError(grpc_error_std_string(error));
absl::Status status = absl::InvalidArgumentError(StatusToString(error));
return status;
}
std::string policy_contents(StringViewFromSlice(policy_slice));

@ -43,6 +43,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/http/httpcli_ssl_credentials.h"
#include "src/core/lib/http/parser.h"
#include "src/core/lib/security/credentials/credentials.h"
@ -553,7 +554,7 @@ grpc_call_credentials* grpc_external_account_credentials_create(
if (!error.ok()) {
gpr_log(GPR_ERROR,
"External account credentials creation failed. Error: %s.",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
return nullptr;
}
return creds;

@ -460,7 +460,7 @@ grpc_channel_credentials* grpc_google_default_credentials_create(
GPR_ASSERT(result != nullptr);
} else {
gpr_log(GPR_ERROR, "Could not create google default credentials: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
return result;
}

@ -47,6 +47,7 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/http/httpcli_ssl_credentials.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/load_file.h"
@ -684,8 +685,7 @@ absl::StatusOr<URI> ValidateStsCredentialsOptions(
}
auto grpc_error_vec = GRPC_ERROR_CREATE_FROM_VECTOR(
"Invalid STS Credentials Options", &error_list);
auto retval =
absl::InvalidArgumentError(grpc_error_std_string(grpc_error_vec));
auto retval = absl::InvalidArgumentError(StatusToString(grpc_error_vec));
return retval;
}

@ -40,6 +40,7 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/stat.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/load_file.h"
@ -283,8 +284,7 @@ FileWatcherCertificateProvider::ReadRootCertificatesFromFile(
grpc_load_file(root_cert_full_path.c_str(), 0, &root_slice);
if (!root_error.ok()) {
gpr_log(GPR_ERROR, "Reading file %s failed: %s",
root_cert_full_path.c_str(),
grpc_error_std_string(root_error).c_str());
root_cert_full_path.c_str(), StatusToString(root_error).c_str());
return absl::nullopt;
}
std::string root_cert(StringViewFromSlice(root_slice));
@ -341,8 +341,7 @@ FileWatcherCertificateProvider::ReadIdentityKeyCertPairFromFiles(
grpc_load_file(private_key_path.c_str(), 0, &key_slice.slice);
if (!key_error.ok()) {
gpr_log(GPR_ERROR, "Reading file %s failed: %s. Start retrying...",
private_key_path.c_str(),
grpc_error_std_string(key_error).c_str());
private_key_path.c_str(), StatusToString(key_error).c_str());
continue;
}
grpc_error_handle cert_error =
@ -350,7 +349,7 @@ FileWatcherCertificateProvider::ReadIdentityKeyCertPairFromFiles(
if (!cert_error.ok()) {
gpr_log(GPR_ERROR, "Reading file %s failed: %s. Start retrying...",
identity_certificate_path.c_str(),
grpc_error_std_string(cert_error).c_str());
StatusToString(cert_error).c_str());
continue;
}
std::string private_key(StringViewFromSlice(key_slice.slice));

@ -40,6 +40,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/promise/promise.h"
#include "src/core/lib/security/context/security_context.h"
@ -380,7 +381,7 @@ void TlsChannelSecurityConnector::cancel_check_peer(
if (!error.ok()) {
gpr_log(GPR_ERROR,
"TlsChannelSecurityConnector::cancel_check_peer error: %s",
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
return;
}
auto* verifier = options_->certificate_verifier();
@ -457,12 +458,12 @@ void TlsChannelSecurityConnector::TlsChannelCertificateWatcher::OnError(
if (!root_cert_error.ok()) {
gpr_log(GPR_ERROR,
"TlsChannelCertificateWatcher getting root_cert_error: %s",
grpc_error_std_string(root_cert_error).c_str());
StatusToString(root_cert_error).c_str());
}
if (!identity_cert_error.ok()) {
gpr_log(GPR_ERROR,
"TlsChannelCertificateWatcher getting identity_cert_error: %s",
grpc_error_std_string(identity_cert_error).c_str());
StatusToString(identity_cert_error).c_str());
}
}
@ -665,7 +666,7 @@ void TlsServerSecurityConnector::cancel_check_peer(
if (!error.ok()) {
gpr_log(GPR_ERROR,
"TlsServerSecurityConnector::cancel_check_peer error: %s",
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
return;
}
auto* verifier = options_->certificate_verifier();
@ -732,12 +733,12 @@ void TlsServerSecurityConnector::TlsServerCertificateWatcher::OnError(
if (!root_cert_error.ok()) {
gpr_log(GPR_ERROR,
"TlsServerCertificateWatcher getting root_cert_error: %s",
grpc_error_std_string(root_cert_error).c_str());
StatusToString(root_cert_error).c_str());
}
if (!identity_cert_error.ok()) {
gpr_log(GPR_ERROR,
"TlsServerCertificateWatcher getting identity_cert_error: %s",
grpc_error_std_string(identity_cert_error).c_str());
StatusToString(identity_cert_error).c_str());
}
}

@ -46,6 +46,7 @@
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/unique_type_name.h"
#include "src/core/lib/iomgr/closure.h"
@ -202,7 +203,7 @@ void SecurityHandshaker::HandshakeFailedLocked(grpc_error_handle error) {
error = GRPC_ERROR_CREATE("Handshaker shutdown");
}
gpr_log(GPR_DEBUG, "Security handshake failed: %s",
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
if (!is_shutdown_) {
tsi_handshaker_shutdown(handshaker_);
// TODO(ctiller): It is currently necessary to shutdown endpoints

@ -856,7 +856,7 @@ void FilterStackCall::CancelWithError(grpc_error_handle error) {
void FilterStackCall::SetFinalStatus(grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_error_trace)) {
gpr_log(GPR_DEBUG, "set_final_status %s", is_client() ? "CLI" : "SVR");
gpr_log(GPR_DEBUG, "%s", grpc_error_std_string(error).c_str());
gpr_log(GPR_DEBUG, "%s", StatusToString(error).c_str());
}
if (is_client()) {
std::string status_details;

@ -45,6 +45,7 @@
#include "src/core/lib/gprpp/atomic_utils.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/exec_ctx.h"
@ -692,7 +693,7 @@ static void cq_end_op_for_next(
grpc_cq_completion* storage, bool /*internal*/) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) ||
(GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) && !error.ok())) {
std::string errmsg = grpc_error_std_string(error);
std::string errmsg = grpc_core::StatusToString(error);
GRPC_API_TRACE(
"cq_end_op_for_next(cq=%p, tag=%p, error=%s, "
"done=%p, done_arg=%p, storage=%p)",
@ -733,7 +734,7 @@ static void cq_end_op_for_next(
if (!kick_error.ok()) {
gpr_log(GPR_ERROR, "Kick failed: %s",
grpc_error_std_string(kick_error).c_str());
grpc_core::StatusToString(kick_error).c_str());
}
}
if (cqd->pending_events.fetch_sub(1, std::memory_order_acq_rel) == 1) {
@ -766,7 +767,7 @@ static void cq_end_op_for_pluck(
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) ||
(GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) && !error.ok())) {
std::string errmsg = grpc_error_std_string(error).c_str();
std::string errmsg = grpc_core::StatusToString(error).c_str();
GRPC_API_TRACE(
"cq_end_op_for_pluck(cq=%p, tag=%p, error=%s, "
"done=%p, done_arg=%p, storage=%p)",
@ -809,7 +810,7 @@ static void cq_end_op_for_pluck(
gpr_mu_unlock(cq->mu);
if (!kick_error.ok()) {
gpr_log(GPR_ERROR, "Kick failed: %s",
grpc_error_std_string(kick_error).c_str());
grpc_core::StatusToString(kick_error).c_str());
}
}
}
@ -828,7 +829,7 @@ static void cq_end_op_for_callback(
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) ||
(GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) && !error.ok())) {
std::string errmsg = grpc_error_std_string(error);
std::string errmsg = grpc_core::StatusToString(error);
GRPC_API_TRACE(
"cq_end_op_for_callback(cq=%p, tag=%p, error=%s, "
"done=%p, done_arg=%p, storage=%p)",
@ -1035,7 +1036,7 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline,
if (!err.ok()) {
gpr_log(GPR_ERROR, "Completion queue next failed: %s",
grpc_error_std_string(err).c_str());
grpc_core::StatusToString(err).c_str());
if (err == absl::CancelledError()) {
ret.type = GRPC_QUEUE_SHUTDOWN;
} else {
@ -1279,7 +1280,7 @@ static grpc_event cq_pluck(grpc_completion_queue* cq, void* tag,
del_plucker(cq, tag, &worker);
gpr_mu_unlock(cq->mu);
gpr_log(GPR_ERROR, "Completion queue pluck failed: %s",
grpc_error_std_string(err).c_str());
grpc_core::StatusToString(err).c_str());
ret.type = GRPC_QUEUE_TIMEOUT;
ret.success = 0;
dump_pending_tags(cq);

@ -1316,7 +1316,7 @@ void Server::CallData::RecvInitialMetadataBatchComplete(
auto* calld = static_cast<Server::CallData*>(elem->call_data);
if (!error.ok()) {
gpr_log(GPR_DEBUG, "Failed call creation: %s",
grpc_error_std_string(error).c_str());
StatusToString(error).c_str());
calld->FailCallCreation();
return;
}

@ -102,7 +102,7 @@ void grpc_error_get_status(grpc_error_handle error,
if (code != nullptr) *code = status;
if (error_string != nullptr && status != GRPC_STATUS_OK) {
*error_string = gpr_strdup(grpc_error_std_string(error).c_str());
*error_string = gpr_strdup(grpc_core::StatusToString(error).c_str());
}
if (http_error != nullptr) {
@ -128,7 +128,7 @@ void grpc_error_get_status(grpc_error_handle error,
if (!grpc_error_get_str(found_error,
grpc_core::StatusStrProperty::kDescription,
message)) {
*message = grpc_error_std_string(error);
*message = grpc_core::StatusToString(error);
}
}
}

@ -36,6 +36,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/timer.h"
@ -91,7 +92,7 @@ bool HandshakeManager::CallNextHandshakerLocked(grpc_error_handle error) {
gpr_log(GPR_INFO,
"handshake_manager %p: error=%s shutdown=%d index=%" PRIuPTR
", args=%s",
this, grpc_error_std_string(error).c_str(), is_shutdown_, index_,
this, StatusToString(error).c_str(), is_shutdown_, index_,
HandshakerArgsString(&args_).c_str());
}
GPR_ASSERT(index_ <= handshakers_.size());
@ -123,7 +124,7 @@ bool HandshakeManager::CallNextHandshakerLocked(grpc_error_handle error) {
gpr_log(GPR_INFO,
"handshake_manager %p: handshaking complete -- scheduling "
"on_handshake_done with error=%s",
this, grpc_error_std_string(error).c_str());
this, StatusToString(error).c_str());
}
// Cancel deadline timer, since we're invoking the on_handshake_done
// callback now.

@ -32,6 +32,7 @@
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/transport/connectivity_state.h"
@ -86,7 +87,7 @@ std::string grpc_transport_stream_op_batch_string(
if (op->cancel_stream) {
out.push_back(absl::StrCat(
" CANCEL:",
grpc_error_std_string(op->payload->cancel_stream.cancel_error)));
grpc_core::StatusToString(op->payload->cancel_stream.cancel_error)));
}
return absl::StrJoin(out, "");
@ -109,12 +110,12 @@ std::string grpc_transport_op_string(grpc_transport_op* op) {
if (!op->disconnect_with_error.ok()) {
out.push_back(absl::StrCat(
" DISCONNECT:", grpc_error_std_string(op->disconnect_with_error)));
" DISCONNECT:", grpc_core::StatusToString(op->disconnect_with_error)));
}
if (!op->goaway_error.ok()) {
out.push_back(
absl::StrCat(" SEND_GOAWAY:", grpc_error_std_string(op->goaway_error)));
out.push_back(absl::StrCat(" SEND_GOAWAY:",
grpc_core::StatusToString(op->goaway_error)));
}
if (op->set_accept_stream) {

@ -468,7 +468,7 @@ static void on_status_received(void* arg, grpc_error_handle error) {
"alts_grpc_handshaker_client:%p on_status_received "
"status:%d details:|%s| error:|%s|",
client, client->handshake_status_code, status_details,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
gpr_free(status_details);
}
maybe_complete_tsi_next(client, true /* receive_status_finished */,

@ -394,7 +394,7 @@ static void on_handshaker_service_resp_recv(void* arg,
if (!error.ok()) {
gpr_log(GPR_INFO,
"ALTS handshaker on_handshaker_service_resp_recv error: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
success = false;
}
alts_handshaker_client_handle_response(client, success);

@ -55,7 +55,7 @@ TlsSessionKeyLoggerCache::TlsSessionKeyLogger::TlsSessionKeyLogger(
gpr_log(GPR_ERROR,
"Ignoring TLS Key logging. ERROR Opening TLS Keylog "
"file: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
}
cache_->tls_session_key_logger_map_.emplace(tls_session_key_log_file_path_,
this);
@ -88,7 +88,7 @@ void TlsSessionKeyLoggerCache::TlsSessionKeyLogger::LogSessionKeys(
if (err) {
grpc_error_handle error = GRPC_OS_ERROR(errno, "fwrite");
gpr_log(GPR_ERROR, "Error Appending to TLS session key log file: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
fclose(fd_);
fd_ = nullptr; // disable future attempts to write to this file
} else {

@ -45,6 +45,7 @@
#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/json/json.h"
@ -238,8 +239,8 @@ grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options) {
}
error = grpc_load_file(sts_creds_path->c_str(), 1, &json_string);
if (!error.ok()) {
status =
grpc::Status(grpc::StatusCode::NOT_FOUND, grpc_error_std_string(error));
status = grpc::Status(grpc::StatusCode::NOT_FOUND,
grpc_core::StatusToString(error));
return cleanup();
}
status = StsCredentialsOptionsFromJson(

@ -26,6 +26,7 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
@ -127,7 +128,7 @@ TEST(ChannelStackTest, CreateChannelStack) {
};
grpc_error_handle error =
grpc_call_stack_init(channel_stack, 1, free_call, call_stack, &args);
ASSERT_TRUE(error.ok()) << grpc_error_std_string(error);
ASSERT_TRUE(error.ok()) << grpc_core::StatusToString(error);
EXPECT_EQ(call_stack->count, 1);
call_elem = grpc_call_stack_element(call_stack, 0);
EXPECT_EQ(call_elem->filter, channel_elem->filter);

@ -73,6 +73,7 @@ grpc_cc_library(
"//:resolved_address",
"//:slice_refcount",
"//:sockaddr_utils",
"//:status_helper",
"//:time",
"//test/core/util:grpc_test_util",
],
@ -117,6 +118,7 @@ grpc_cc_test(
"//:grpc",
"//:grpc_public_hdrs",
"//:iomgr_fwd",
"//:status_helper",
"//test/core/util:grpc_test_util",
],
)

@ -38,6 +38,7 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/endpoint.h"
@ -129,7 +130,7 @@ static void handle_write() {
static void handle_read(void* /*arg*/, grpc_error_handle error) {
if (!error.ok()) {
gpr_log(GPR_ERROR, "handle_read error: %s",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
return;
}
state.incoming_data_length += state.temp_incoming_buffer.length;

@ -43,6 +43,7 @@
#include "src/core/lib/event_engine/channel_args_endpoint_config.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/http/parser.h"
@ -182,7 +183,7 @@ static void on_read_request_done_locked(void* arg, grpc_error_handle error);
static void proxy_connection_failed(proxy_connection* conn,
failure_type failure, const char* prefix,
grpc_error_handle error) {
gpr_log(GPR_INFO, "%s: %s", prefix, grpc_error_std_string(error).c_str());
gpr_log(GPR_INFO, "%s: %s", prefix, grpc_core::StatusToString(error).c_str());
// Decide whether we should shut down the client and server.
bool shutdown_client = false;
bool shutdown_server = false;
@ -473,7 +474,7 @@ static bool proxy_auth_header_matches(char* proxy_auth_header_val,
static void on_read_request_done_locked(void* arg, grpc_error_handle error) {
proxy_connection* conn = static_cast<proxy_connection*>(arg);
gpr_log(GPR_DEBUG, "on_read_request_done: %p %s", conn,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
if (!error.ok()) {
proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy read request",
error);

@ -43,6 +43,7 @@
#include <grpc/support/time.h>
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/time_util.h"
#include "src/core/lib/iomgr/pollset.h"
@ -163,7 +164,7 @@ void OnFinish(void* arg, grpc_error_handle error) {
GPR_ASSERT(error.ok());
grpc_http_response response = request_state->response;
gpr_log(GPR_INFO, "response status=%d error=%s", response.status,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
GPR_ASSERT(response.status == 200);
GPR_ASSERT(response.body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response.body, response.body_length));
@ -181,7 +182,7 @@ void OnFinishExpectFailure(void* arg, grpc_error_handle error) {
}
grpc_http_response response = request_state->response;
gpr_log(GPR_INFO, "response status=%d error=%s", response.status,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
GPR_ASSERT(!error.ok());
request_state->test->RunAndKick(
[request_state]() { request_state->done = true; });

@ -41,6 +41,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/time_util.h"
@ -162,7 +163,7 @@ void OnFinish(void* arg, grpc_error_handle error) {
GPR_ASSERT(error.ok());
grpc_http_response response = request_state->response;
gpr_log(GPR_INFO, "response status=%d error=%s", response.status,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
GPR_ASSERT(response.status == 200);
GPR_ASSERT(response.body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response.body, response.body_length));
@ -174,7 +175,7 @@ void OnFinishExpectFailure(void* arg, grpc_error_handle error) {
RequestState* request_state = static_cast<RequestState*>(arg);
grpc_http_response response = request_state->response;
gpr_log(GPR_INFO, "response status=%d error=%s", response.status,
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
GPR_ASSERT(!error.ok());
request_state->test->RunAndKick(
[request_state]() { request_state->done = true; });

@ -147,7 +147,7 @@ TEST(ErrorTest, PrintErrorString) {
error = grpc_error_set_int(error, grpc_core::StatusIntProperty::kSize, 666);
error = grpc_error_set_str(error, grpc_core::StatusStrProperty::kGrpcMessage,
"message");
// gpr_log(GPR_DEBUG, "%s", grpc_error_std_string(error).c_str());
// gpr_log(GPR_DEBUG, "%s", grpc_core::StatusToString(error).c_str());
}
TEST(ErrorTest, PrintErrorStringReference) {

@ -59,7 +59,7 @@ static void must_succeed(void* arg, grpc_error_handle error) {
static void must_fail(void* arg, grpc_error_handle error) {
GPR_ASSERT(g_connecting == nullptr);
GPR_ASSERT(!error.ok());
NSLog(@"%s", grpc_error_std_string(error).c_str());
NSLog(@"%s", grpc_core::StatusToString(error).c_str());
finish_connection();
}

@ -417,7 +417,7 @@ static void test_connect(size_t num_connects,
continue;
}
gpr_log(GPR_ERROR, "Failed to connect to %s: %s", dst.str,
grpc_error_std_string(err).c_str());
grpc_core::StatusToString(err).c_str());
ASSERT_TRUE(test_dst_addrs);
dst_addrs->addrs[dst_idx].addr.len = 0;
}

@ -516,8 +516,8 @@ class RequestMetadataState : public RefCounted<RequestMetadataState> {
void CheckRequestMetadata(grpc_error_handle error) {
gpr_log(GPR_INFO, "expected_error: %s",
grpc_error_std_string(expected_error_).c_str());
gpr_log(GPR_INFO, "actual_error: %s", grpc_error_std_string(error).c_str());
StatusToString(expected_error_).c_str());
gpr_log(GPR_INFO, "actual_error: %s", StatusToString(error).c_str());
if (expected_error_.ok()) {
GPR_ASSERT(error.ok());
} else {

@ -45,7 +45,7 @@ static void on_metadata_response(void* arg, grpc_error_handle error) {
synchronizer* sync = static_cast<synchronizer*>(arg);
if (!error.ok()) {
fprintf(stderr, "Fetching token failed: %s\n",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
fflush(stderr);
} else {
char* token;

@ -178,7 +178,7 @@ MATCHER_P4(TransactionMatches, flag, method_ref, initial_metadata, message_data,
// Matches with grpc_error having error message containing |msg|.
MATCHER_P(GrpcErrorMessageContains, msg, "") {
return absl::StrContains(grpc_error_std_string(arg), msg);
return absl::StrContains(grpc_core::StatusToString(arg), msg);
}
namespace {

@ -35,6 +35,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/memory_quota.h"
@ -108,7 +109,7 @@ class ParseTest : public ::testing::TestWithParam<Test> {
auto err = parser_->Parse(slices[i], i == nslices - 1);
if (!err.ok()) {
gpr_log(GPR_ERROR, "Unexpected parse error: %s",
grpc_error_std_string(err).c_str());
grpc_core::StatusToString(err).c_str());
abort();
}
}

@ -42,6 +42,7 @@
#include "src/core/lib/channel/channel_args_preconditioning.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/event_engine/channel_args_endpoint_config.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/endpoint.h"
@ -206,8 +207,7 @@ class Client {
private:
static void OnEventDone(void* arg, grpc_error_handle error) {
gpr_log(GPR_INFO, "OnEventDone(): %s",
grpc_error_std_string(error).c_str());
gpr_log(GPR_INFO, "OnEventDone(): %s", StatusToString(error).c_str());
EventState* state = static_cast<EventState*>(arg);
state->error_ = error;
gpr_atm_rel_store(&state->done_atm_, 1);

@ -141,6 +141,7 @@ grpc_cc_library(
"//:resolved_address",
"//:slice",
"//:slice_refcount",
"//:status_helper",
"//:time",
"//:tsi_ssl_credentials",
"//:uri_parser",
@ -176,6 +177,7 @@ grpc_cc_library(
"//:orphanable",
"//:ref_counted_ptr",
"//:resolved_address",
"//:status_helper",
"//:time",
"//:uri_parser",
"//test/core/event_engine:test_init",
@ -304,6 +306,7 @@ grpc_cc_library(
"//:ref_counted_ptr",
"//:resolved_address",
"//:server_address",
"//:status_helper",
"//:subchannel_interface",
"//:time",
"//:uri_parser",

@ -100,13 +100,13 @@ FakeUdpAndTcpServer::FakeUdpAndTcpServer(
set_non_block_error = grpc_tcp_set_non_block(udp_socket_);
if (!set_non_block_error.ok()) {
gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s",
grpc_error_std_string(set_non_block_error).c_str());
StatusToString(set_non_block_error).c_str());
GPR_ASSERT(0);
}
set_non_block_error = grpc_tcp_set_non_block(accept_socket_);
if (!set_non_block_error.ok()) {
gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s",
grpc_error_std_string(set_non_block_error).c_str());
StatusToString(set_non_block_error).c_str());
GPR_ASSERT(0);
}
#else
@ -260,7 +260,7 @@ void FakeUdpAndTcpServer::RunServerLoop() {
set_non_block_error = grpc_tcp_set_non_block(p);
if (!set_non_block_error.ok()) {
gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s",
grpc_error_std_string(set_non_block_error).c_str());
StatusToString(set_non_block_error).c_str());
GPR_ASSERT(0);
}
#else

@ -30,6 +30,7 @@
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/http/parser.h"
#include "src/core/lib/iomgr/closure.h"
@ -157,7 +158,7 @@ static void got_port_from_server(void* arg, grpc_error_handle error) {
if (!error.ok()) {
failed = 1;
gpr_log(GPR_DEBUG, "failed port pick from server: retrying [%s]",
grpc_error_std_string(error).c_str());
grpc_core::StatusToString(error).c_str());
} else if (response->status != 200) {
failed = 1;
gpr_log(GPR_DEBUG, "failed port pick from server: status=%d",

@ -35,6 +35,7 @@
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/pollset_set.h"
@ -528,8 +529,7 @@ class FixedAddressFactory : public LoadBalancingPolicyFactory {
if (!error_list.empty()) {
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_VECTOR(
"errors parsing fixed_address_lb config", &error_list);
absl::Status status =
absl::InvalidArgumentError(grpc_error_std_string(error));
absl::Status status = absl::InvalidArgumentError(StatusToString(error));
return status;
}
return MakeRefCounted<FixedAddressConfig>(std::move(address));

@ -26,6 +26,7 @@
#include <grpc/grpc.h>
#include "src/core/lib/gprpp/status_helper.h"
#include "test/core/util/test_config.h"
namespace grpc_core {
@ -51,7 +52,7 @@ TEST(FileWatcherConfigTest, Basic) {
grpc_error_handle error;
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
ASSERT_EQ(error, absl::OkStatus()) << grpc_error_std_string(error);
ASSERT_EQ(error, absl::OkStatus()) << StatusToString(error);
EXPECT_EQ(config->identity_cert_file(), kIdentityCertFile);
EXPECT_EQ(config->private_key_file(), kPrivateKeyFile);
EXPECT_EQ(config->root_cert_file(), kRootCertFile);
@ -71,7 +72,7 @@ TEST(FileWatcherConfigTest, DefaultRefreshInterval) {
grpc_error_handle error;
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
ASSERT_EQ(error, absl::OkStatus()) << grpc_error_std_string(error);
ASSERT_EQ(error, absl::OkStatus()) << StatusToString(error);
EXPECT_EQ(config->identity_cert_file(), kIdentityCertFile);
EXPECT_EQ(config->private_key_file(), kPrivateKeyFile);
EXPECT_EQ(config->root_cert_file(), kRootCertFile);
@ -89,7 +90,7 @@ TEST(FileWatcherConfigTest, OnlyRootCertificatesFileProvided) {
grpc_error_handle error;
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
ASSERT_EQ(error, absl::OkStatus()) << grpc_error_std_string(error);
ASSERT_EQ(error, absl::OkStatus()) << StatusToString(error);
EXPECT_TRUE(config->identity_cert_file().empty());
EXPECT_TRUE(config->private_key_file().empty());
EXPECT_EQ(config->root_cert_file(), kRootCertFile);
@ -108,7 +109,7 @@ TEST(FileWatcherConfigTest, OnlyIdenityCertificatesAndPrivateKeyProvided) {
grpc_error_handle error;
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
ASSERT_EQ(error, absl::OkStatus()) << grpc_error_std_string(error);
ASSERT_EQ(error, absl::OkStatus()) << StatusToString(error);
EXPECT_EQ(config->identity_cert_file(), kIdentityCertFile);
EXPECT_EQ(config->private_key_file(), kPrivateKeyFile);
EXPECT_TRUE(config->root_cert_file().empty());
@ -128,7 +129,7 @@ TEST(FileWatcherConfigTest, WrongTypes) {
grpc_error_handle error;
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(grpc_error_std_string(error),
EXPECT_THAT(StatusToString(error),
::testing::ContainsRegex(
"field:certificate_file error:type should be STRING.*"
"field:private_key_file error:type should be STRING.*"
@ -149,7 +150,7 @@ TEST(FileWatcherConfigTest, IdentityCertProvidedButPrivateKeyMissing) {
grpc_error_handle error;
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(grpc_error_std_string(error),
EXPECT_THAT(StatusToString(error),
::testing::ContainsRegex(
"fields \"certificate_file\" and \"private_key_file\" must "
"be both set or both unset."));
@ -166,7 +167,7 @@ TEST(FileWatcherConfigTest, PrivateKeyProvidedButIdentityCertMissing) {
grpc_error_handle error;
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(grpc_error_std_string(error),
EXPECT_THAT(StatusToString(error),
::testing::ContainsRegex(
"fields \"certificate_file\" and \"private_key_file\" must "
"be both set or both unset."));
@ -180,7 +181,7 @@ TEST(FileWatcherConfigTest, EmptyJsonObject) {
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
StatusToString(error),
::testing::ContainsRegex("At least one of \"certificate_file\" and "
"\"ca_certificate_file\" must be specified."));
}

@ -25,6 +25,7 @@
#include <grpc/grpc.h>
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h"
#include "test/core/util/test_config.h"
@ -76,7 +77,7 @@ TEST(GoogleMeshCaConfigTest, Basic) {
grpc_error_handle error;
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
ASSERT_EQ(error, absl::OkStatus()) << grpc_error_std_string(error);
ASSERT_EQ(error, absl::OkStatus()) << StatusToString(error);
EXPECT_EQ(config->endpoint(), "newmeshca.googleapis.com");
EXPECT_EQ(config->sts_config().token_exchange_service_uri,
"newsecuretoken.googleapis.com");
@ -129,7 +130,7 @@ TEST(GoogleMeshCaConfigTest, Defaults) {
grpc_error_handle error;
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
ASSERT_EQ(error, absl::OkStatus()) << grpc_error_std_string(error);
ASSERT_EQ(error, absl::OkStatus()) << StatusToString(error);
EXPECT_EQ(config->endpoint(), "meshca.googleapis.com");
EXPECT_EQ(config->sts_config().token_exchange_service_uri,
"securetoken.googleapis.com");
@ -182,7 +183,7 @@ TEST(GoogleMeshCaConfigTest, WrongExpectedValues) {
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
StatusToString(error),
::testing::ContainsRegex("field:api_type error:Only GRPC is supported.*"
"field:key_type error:Only RSA is supported"));
}
@ -224,7 +225,7 @@ TEST(GoogleMeshCaConfigTest, WrongTypes) {
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
StatusToString(error),
::testing::ContainsRegex(
"field:server.*field:api_type error:type should be STRING.*"
"field:grpc_services.*field:google_grpc.*field:target_uri "
@ -267,7 +268,7 @@ TEST(GoogleMeshCaConfigTest, GrpcServicesNotAnArray) {
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
StatusToString(error),
::testing::ContainsRegex(
"field:server.*field:grpc_services error:type should be ARRAY"));
}
@ -291,7 +292,7 @@ TEST(GoogleMeshCaConfigTest, GoogleGrpcNotAnObject) {
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
StatusToString(error),
::testing::ContainsRegex("field:server.*field:grpc_services.*field:"
"google_grpc error:type should be OBJECT"));
}
@ -316,7 +317,7 @@ TEST(GoogleMeshCaConfigTest, CallCredentialsNotAnArray) {
grpc_error_handle error;
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(grpc_error_std_string(error),
EXPECT_THAT(StatusToString(error),
::testing::ContainsRegex(
"field:server.*field:grpc_services.*field:google_grpc.*"
"field:call_credentials error:type should be ARRAY"));
@ -345,7 +346,7 @@ TEST(GoogleMeshCaConfigTest, StsServiceNotAnObject) {
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(*json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
StatusToString(error),
::testing::ContainsRegex(
"field:server.*field:grpc_services.*field:google_grpc.*field:"
"call_credentials.*field:sts_service error:type should be OBJECT"));

@ -25,6 +25,7 @@
#include <grpc/grpc.h>
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
#include "test/core/util/test_config.h"
@ -147,16 +148,16 @@ TEST(
"identity", absl::nullopt, GRPC_ERROR_CREATE(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for root certs. Test that the root cert error is reset.
root_cert_distributor->SetKeyMaterials("root", kRootCert1, absl::nullopt);
EXPECT_EQ(watcher->root_certs(), kRootCert1);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_EQ(watcher->root_cert_error(), absl::OkStatus());
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity certs. Test that the identity cert error is
// reset.
@ -213,16 +214,16 @@ TEST(XdsCertificateProviderTest,
"test", absl::nullopt, GRPC_ERROR_CREATE(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for root certs. Test that the root cert error is reset.
root_cert_distributor->SetKeyMaterials("test", kRootCert1, absl::nullopt);
EXPECT_EQ(watcher->root_certs(), kRootCert1);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_EQ(watcher->root_cert_error(), absl::OkStatus());
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity certs. Test that the identity cert error is
// reset.
@ -276,7 +277,7 @@ TEST(XdsCertificateProviderTest,
GRPC_ERROR_CREATE(kRootErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_EQ(watcher->identity_cert_error(), absl::OkStatus());
distributor->SetErrorForCert("identity",
@ -284,16 +285,16 @@ TEST(XdsCertificateProviderTest,
GRPC_ERROR_CREATE(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for root
distributor->SetKeyMaterials("root", kRootCert1, MakeKeyCertPairsType1());
EXPECT_EQ(watcher->root_certs(), kRootCert1);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_EQ(watcher->root_cert_error(), absl::OkStatus());
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity
distributor->SetKeyMaterials("identity", kRootCert2, MakeKeyCertPairsType1());
@ -339,7 +340,7 @@ TEST(XdsCertificateProviderTest,
absl::nullopt);
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_EQ(watcher->identity_cert_error(), absl::OkStatus());
// Set error for identity
@ -347,16 +348,16 @@ TEST(XdsCertificateProviderTest,
GRPC_ERROR_CREATE(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for root
distributor->SetKeyMaterials("", kRootCert1, absl::nullopt);
EXPECT_EQ(watcher->root_certs(), kRootCert1);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_EQ(watcher->root_cert_error(), absl::OkStatus());
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity
distributor->SetKeyMaterials("", absl::nullopt, MakeKeyCertPairsType1());
@ -376,11 +377,11 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
// Initially there are no certificate providers.
EXPECT_EQ(watcher->root_certs(), absl::nullopt);
EXPECT_EQ(watcher->key_cert_pairs(), absl::nullopt);
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_std_string(watcher->identity_cert_error()),
StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Update root cert distributor.
@ -389,7 +390,7 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
EXPECT_EQ(watcher->key_cert_pairs(), absl::nullopt);
EXPECT_EQ(watcher->root_cert_error(), absl::OkStatus());
EXPECT_THAT(
grpc_error_std_string(watcher->identity_cert_error()),
StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Update identity cert distributor
@ -409,9 +410,9 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
GRPC_ERROR_CREATE(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
EXPECT_THAT(StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update again
distributor->SetKeyMaterials("", kRootCert1, MakeKeyCertPairsType1());
@ -424,7 +425,7 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
distributor->SetKeyMaterials("", kRootCert2, MakeKeyCertPairsType2());
EXPECT_EQ(watcher->root_certs(), kRootCert1); // not updated
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_EQ(watcher->identity_cert_error(), absl::OkStatus());
@ -433,11 +434,11 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
distributor->SetKeyMaterials("", kRootCert1, MakeKeyCertPairsType1());
EXPECT_EQ(watcher->root_certs(), kRootCert1);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2()); // not updated
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_std_string(watcher->identity_cert_error()),
StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Change certificate names being watched, without any certificate updates.
@ -445,11 +446,11 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
provider.UpdateIdentityCertNameAndDistributor("", "identity", distributor);
EXPECT_EQ(watcher->root_certs(), kRootCert1);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_std_string(watcher->identity_cert_error()),
StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Send out certificate updates.
@ -501,11 +502,11 @@ TEST(XdsCertificateProviderTest, MultipleCertNames) {
std::unique_ptr<TestCertificatesWatcher>(watcher1), "test1", "test1");
EXPECT_EQ(watcher1->root_certs(), absl::nullopt);
EXPECT_EQ(watcher1->key_cert_pairs(), absl::nullopt);
EXPECT_THAT(grpc_error_std_string(watcher1->root_cert_error()),
EXPECT_THAT(StatusToString(watcher1->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_std_string(watcher1->identity_cert_error()),
StatusToString(watcher1->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Add distributor for "test1". This will return data to the watcher.
@ -549,11 +550,11 @@ TEST(XdsCertificateProviderTest, UnknownCertName) {
auto* watcher = new TestCertificatesWatcher;
provider.distributor()->WatchTlsCertificates(
std::unique_ptr<TestCertificatesWatcher>(watcher), "test", "test");
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
EXPECT_THAT(StatusToString(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_std_string(watcher->identity_cert_error()),
StatusToString(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
}

Loading…
Cancel
Save