Migrated from grpc_error_string to grpc_error_std_string (#26068)

* Added grpc_error_std_string
* Migrated to grpc_error_std_string
reviewable/pr25738/r7^2
Esun Kim 4 years ago committed by GitHub
parent 3732ee0317
commit 460898f11c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 51
      src/core/ext/filters/client_channel/client_channel.cc
  2. 5
      src/core/ext/filters/client_channel/dynamic_filters.cc
  3. 11
      src/core/ext/filters/client_channel/health/health_check_client.cc
  4. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  5. 2
      src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
  6. 6
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
  7. 6
      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. 6
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  10. 2
      src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
  11. 4
      src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc
  12. 4
      src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc
  13. 17
      src/core/ext/filters/client_channel/retry_filter.cc
  14. 3
      src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc
  15. 8
      src/core/ext/filters/client_channel/subchannel.cc
  16. 2
      src/core/ext/filters/fault_injection/fault_injection_filter.cc
  17. 13
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  18. 3
      src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
  19. 2
      src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
  20. 3
      src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
  21. 12
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  22. 3
      src/core/ext/transport/chttp2/transport/parsing.cc
  23. 7
      src/core/ext/transport/inproc/inproc_transport.cc
  24. 5
      src/core/ext/xds/xds_api.cc
  25. 19
      src/core/ext/xds/xds_client.cc
  26. 10
      src/core/ext/xds/xds_server_config_fetcher.cc
  27. 4
      src/core/lib/channel/handshaker.cc
  28. 5
      src/core/lib/http/httpcli_security_connector.cc
  29. 6
      src/core/lib/iomgr/call_combiner.cc
  30. 3
      src/core/lib/iomgr/call_combiner.h
  31. 6
      src/core/lib/iomgr/endpoint_cfstream.cc
  32. 4
      src/core/lib/iomgr/error.cc
  33. 2
      src/core/lib/iomgr/error.h
  34. 2
      src/core/lib/iomgr/lockfree_event.cc
  35. 4
      src/core/lib/iomgr/parse_address.cc
  36. 3
      src/core/lib/iomgr/tcp_client_custom.cc
  37. 6
      src/core/lib/iomgr/tcp_client_posix.cc
  38. 18
      src/core/lib/iomgr/tcp_custom.cc
  39. 21
      src/core/lib/iomgr/tcp_posix.cc
  40. 5
      src/core/lib/iomgr/tcp_server_custom.cc
  41. 4
      src/core/lib/iomgr/tcp_server_posix.cc
  42. 4
      src/core/lib/iomgr/tcp_server_windows.cc
  43. 2
      src/core/lib/security/authorization/rbac_translator.cc
  44. 4
      src/core/lib/security/credentials/external/external_account_credentials.cc
  45. 2
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  46. 3
      src/core/lib/security/credentials/jwt/jwt_verifier.cc
  47. 8
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  48. 9
      src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc
  49. 8
      src/core/lib/security/security_connector/tls/tls_security_connector.cc
  50. 5
      src/core/lib/security/transport/security_handshaker.cc
  51. 2
      src/core/lib/security/transport/server_auth_filter.cc
  52. 2
      src/core/lib/surface/call.cc
  53. 2
      src/core/lib/surface/channel.cc
  54. 42
      src/core/lib/surface/completion_queue.cc
  55. 2
      src/core/lib/transport/error_utils.cc
  56. 10
      src/core/lib/transport/transport_op_string.cc
  57. 2
      src/core/tsi/alts/handshaker/alts_handshaker_client.cc
  58. 2
      src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
  59. 2
      src/cpp/client/secure_credentials.cc
  60. 2
      src/cpp/common/validate_service_config.cc
  61. 22
      test/core/channel/channelz_test.cc
  62. 3
      test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
  63. 100
      test/core/client_channel/service_config_test.cc
  64. 3
      test/core/end2end/bad_server_response_test.cc
  65. 4
      test/core/end2end/fixtures/http_proxy_fixture.cc
  66. 2
      test/core/http/httpcli_test.cc
  67. 2
      test/core/http/httpscli_test.cc
  68. 2
      test/core/iomgr/error_test.cc
  69. 3
      test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm
  70. 2
      test/core/iomgr/tcp_server_posix_test.cc
  71. 4
      test/core/json/json_test.cc
  72. 4
      test/core/security/credentials_test.cc
  73. 3
      test/core/security/json_token_test.cc
  74. 15
      test/core/security/jwt_verifier_test.cc
  75. 3
      test/core/security/oauth2_utils.cc
  76. 3
      test/core/security/print_google_default_creds_token.cc
  77. 5
      test/core/transport/chttp2/settings_timeout_test.cc
  78. 5
      test/core/util/port_server_client.cc
  79. 32
      test/core/xds/file_watcher_certificate_provider_factory_test.cc
  80. 32
      test/core/xds/google_mesh_ca_certificate_provider_factory_test.cc
  81. 80
      test/core/xds/xds_bootstrap_test.cc
  82. 56
      test/core/xds/xds_certificate_provider_test.cc
  83. 2
      test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc
  84. 4
      test/cpp/end2end/xds_end2end_test.cc
  85. 5
      test/cpp/naming/resolver_component_test.cc
  86. 2
      test/cpp/util/channel_trace_proto_helper.cc

@ -1247,21 +1247,19 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
trace_strings.push_back("Address list became non-empty");
}
previous_resolution_contained_addresses_ = !result.addresses.empty();
// The result of grpc_error_string() is owned by the error itself.
// We're storing that string in trace_strings, so we need to make sure
// that the error lives until we're done with the string.
grpc_error_handle service_config_error =
GRPC_ERROR_REF(result.service_config_error);
if (service_config_error != GRPC_ERROR_NONE) {
trace_strings.push_back(grpc_error_string(service_config_error));
std::string service_config_error_string_storage;
if (result.service_config_error != GRPC_ERROR_NONE) {
service_config_error_string_storage =
grpc_error_std_string(result.service_config_error);
trace_strings.push_back(service_config_error_string_storage.c_str());
}
// Choose the service config.
RefCountedPtr<ServiceConfig> service_config;
RefCountedPtr<ConfigSelector> config_selector;
if (service_config_error != GRPC_ERROR_NONE) {
if (result.service_config_error != GRPC_ERROR_NONE) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO, "chand=%p: resolver returned service config error: %s",
this, grpc_error_string(service_config_error));
this, grpc_error_std_string(result.service_config_error).c_str());
}
// If the service config was invalid, then fallback to the
// previously returned service config.
@ -1278,7 +1276,7 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
// We received an invalid service config and we don't have a
// previous service config to fall back to. Put the channel into
// TRANSIENT_FAILURE.
OnResolverErrorLocked(GRPC_ERROR_REF(service_config_error));
OnResolverErrorLocked(GRPC_ERROR_REF(result.service_config_error));
trace_strings.push_back("no valid service config");
}
} else if (result.service_config == nullptr) {
@ -1343,7 +1341,6 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
grpc_slice_from_cpp_string(message));
}
}
GRPC_ERROR_UNREF(service_config_error);
}
void ClientChannel::OnResolverErrorLocked(grpc_error_handle error) {
@ -1353,7 +1350,7 @@ void ClientChannel::OnResolverErrorLocked(grpc_error_handle error) {
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO, "chand=%p: resolver transient failure: %s", this,
grpc_error_string(error));
grpc_error_std_string(error).c_str());
}
// If we already have an LB policy from a previous resolution
// result, then we continue to let it set the connectivity state.
@ -1731,7 +1728,7 @@ void ClientChannel::StartTransportOpLocked(grpc_transport_op* op) {
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", this,
grpc_error_string(op->disconnect_with_error));
grpc_error_std_string(op->disconnect_with_error).c_str());
}
DestroyResolverAndLbPolicyLocked();
intptr_t value;
@ -1930,7 +1927,8 @@ void ClientChannel::CallData::StartTransportStreamOpBatch(
if (GPR_UNLIKELY(calld->cancel_error_ != GRPC_ERROR_NONE)) {
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_string(calld->cancel_error_));
chand, calld,
grpc_error_std_string(calld->cancel_error_).c_str());
}
// Note: This will release the call combiner.
grpc_transport_stream_op_batch_finish_with_failure(
@ -1949,7 +1947,7 @@ void ClientChannel::CallData::StartTransportStreamOpBatch(
GRPC_ERROR_REF(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_string(calld->cancel_error_));
calld, grpc_error_std_string(calld->cancel_error_).c_str());
}
// If we do not have a dynamic call (i.e., name resolution has not
// yet completed), fail all pending batches. Otherwise, send the
@ -2065,7 +2063,8 @@ void ClientChannel::CallData::PendingBatchesFail(
}
gpr_log(GPR_INFO,
"chand=%p calld=%p: failing %" PRIuPTR " pending batches: %s",
elem->channel_data, this, num_batches, grpc_error_string(error));
elem->channel_data, this, num_batches,
grpc_error_std_string(error).c_str());
}
CallCombinerClosureList closures;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
@ -2157,7 +2156,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_string(error), self,
chand, calld, grpc_error_std_string(error).c_str(), self,
calld->resolver_call_canceller_);
}
if (calld->resolver_call_canceller_ == self && error != GRPC_ERROR_NONE) {
@ -2307,7 +2306,7 @@ void ClientChannel::CallData::ResolutionDone(void* arg,
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: error applying config to call: error=%s",
chand, calld, grpc_error_string(error));
chand, calld, grpc_error_std_string(error).c_str());
}
calld->PendingBatchesFail(elem, GRPC_ERROR_REF(error), YieldCallCombiner);
return;
@ -2416,7 +2415,7 @@ void ClientChannel::CallData::CreateDynamicCall(grpc_call_element* elem) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: failed to create dynamic call: error=%s",
chand, this, grpc_error_string(error));
chand, this, grpc_error_std_string(error).c_str());
}
PendingBatchesFail(elem, error, YieldCallCombiner);
return;
@ -2617,7 +2616,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_string(error));
chand_, this, num_batches, grpc_error_std_string(error).c_str());
}
CallCombinerClosureList closures;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
@ -2689,7 +2688,7 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
if (GPR_UNLIKELY(cancel_error_ != GRPC_ERROR_NONE)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: failing batch with error: %s",
chand_, this, grpc_error_string(cancel_error_));
chand_, this, grpc_error_std_string(cancel_error_).c_str());
}
// Note: This will release the call combiner.
grpc_transport_stream_op_batch_finish_with_failure(
@ -2707,7 +2706,7 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
cancel_error_ = GRPC_ERROR_REF(batch->payload->cancel_stream.cancel_error);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: recording cancel_error=%s",
chand_, this, grpc_error_string(cancel_error_));
chand_, this, grpc_error_std_string(cancel_error_).c_str());
}
// If we do not have a subchannel call (i.e., a pick has not yet
// been started), fail all pending batches. Otherwise, send the
@ -2830,7 +2829,7 @@ void ClientChannel::LoadBalancedCall::CreateSubchannelCall() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: create subchannel_call=%p: error=%s", chand_,
this, subchannel_call_.get(), grpc_error_string(error));
this, subchannel_call_.get(), grpc_error_std_string(error).c_str());
}
if (on_call_destruction_complete_ != nullptr) {
subchannel_call_->SetAfterCallStackDestroy(on_call_destruction_complete_);
@ -2870,7 +2869,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_string(error), self,
chand, lb_call, grpc_error_std_string(error).c_str(), self,
lb_call->lb_call_canceller_);
}
if (lb_call->lb_call_canceller_ == self && error != GRPC_ERROR_NONE) {
@ -2926,7 +2925,7 @@ void ClientChannel::LoadBalancedCall::PickDone(void* arg,
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: failed to pick subchannel: error=%s",
self->chand_, self, grpc_error_string(error));
self->chand_, self, grpc_error_std_string(error).c_str());
}
self->PendingBatchesFail(GRPC_ERROR_REF(error), YieldCallCombiner);
return;
@ -2989,7 +2988,7 @@ bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(
GPR_INFO,
"chand=%p lb_call=%p: LB pick returned %s (subchannel=%p, error=%s)",
chand_, this, PickResultTypeName(result.type), result.subchannel.get(),
grpc_error_string(result.error));
grpc_error_std_string(result.error).c_str());
}
switch (result.type) {
case LoadBalancingPolicy::PickResult::PICK_FAILED: {

@ -53,8 +53,7 @@ DynamicFilters::Call::Call(Args args, grpc_error_handle* error)
*error = grpc_call_stack_init(channel_stack_->channel_stack_, 1, Destroy,
this, &call_args);
if (GPR_UNLIKELY(*error != GRPC_ERROR_NONE)) {
const char* error_string = grpc_error_string(*error);
gpr_log(GPR_ERROR, "error: %s", error_string);
gpr_log(GPR_ERROR, "error: %s", grpc_error_std_string(*error).c_str());
return;
}
grpc_call_stack_set_pollset_or_pollset_set(call_stack, args.pollent);
@ -145,7 +144,7 @@ std::pair<grpc_channel_stack*, grpc_error_handle> CreateChannelStack(
channel_stack);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "error initializing client internal stack: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
grpc_channel_stack_destroy(channel_stack);
gpr_free(channel_stack);
return {nullptr, error};

@ -301,7 +301,8 @@ void HealthCheckClient::CallState::StartCall() {
gpr_log(GPR_ERROR,
"HealthCheckClient %p CallState %p: error creating health "
"checking call on subchannel (%s); will retry",
health_check_client_.get(), this, grpc_error_string(error));
health_check_client_.get(), this,
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
CallEndedLocked(/*retry=*/true);
return;
@ -465,10 +466,10 @@ void HealthCheckClient::CallState::DoneReadingRecvMessage(
const bool healthy = DecodeResponse(&recv_message_buffer_, &error);
const grpc_connectivity_state state =
healthy ? GRPC_CHANNEL_READY : GRPC_CHANNEL_TRANSIENT_FAILURE;
const char* reason = error == GRPC_ERROR_NONE && !healthy
? "backend unhealthy"
: grpc_error_string(error);
health_check_client_->SetHealthStatus(state, reason);
health_check_client_->SetHealthStatus(
state, error == GRPC_ERROR_NONE && !healthy
? "backend unhealthy"
: grpc_error_std_string(error).c_str());
seen_response_.Store(true, MemoryOrder::RELEASE);
grpc_slice_buffer_destroy_internal(&recv_message_buffer_);
// Start another recv_message batch.

@ -1202,7 +1202,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_string(error));
grpc_error_std_string(error).c_str());
gpr_free(status_details);
}
GRPC_ERROR_UNREF(error);

@ -545,7 +545,7 @@ void CdsLb::OnClusterChanged(const std::string& name,
void CdsLb::OnError(const std::string& name, grpc_error_handle error) {
gpr_log(GPR_ERROR, "[cdslb %p] xds error obtaining data for cluster %s: %s",
this, name.c_str(), grpc_error_string(error));
this, name.c_str(), grpc_error_std_string(error).c_str());
// Go into TRANSIENT_FAILURE if we have not yet created the child
// policy (i.e., we have not yet received data from xds). Otherwise,
// we keep running with the data we had previously.

@ -734,7 +734,7 @@ void XdsClusterResolverLb::OnError(size_t index, grpc_error_handle error) {
gpr_log(GPR_ERROR,
"[xds_cluster_resolver_lb %p] discovery mechanism %" PRIuPTR
" xds watcher reported error: %s",
this, index, grpc_error_string(error));
this, index, grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
if (shutting_down_) return;
if (!discovery_mechanisms_[index].first_update_received) {
@ -1012,7 +1012,7 @@ XdsClusterResolverLb::CreateChildPolicyConfigLocked() {
"[xds_cluster_resolver_lb %p] error parsing generated child policy "
"config -- "
"will put channel in TRANSIENT_FAILURE: %s",
this, grpc_error_string(error));
this, grpc_error_std_string(error).c_str());
error = grpc_error_set_int(
grpc_error_add_child(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"xds_cluster_resolver LB policy: error "
@ -1112,7 +1112,7 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory {
gpr_log(GPR_ERROR,
"cannot get or create XdsClient to instantiate "
"xds_cluster_resolver LB policy: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
return nullptr;
}

@ -204,7 +204,7 @@ void AresDnsResolver::OnNextResolutionLocked(grpc_error_handle error) {
GRPC_CARES_TRACE_LOG(
"resolver:%p re-resolution timer fired. error: %s. shutdown_initiated_: "
"%d",
this, grpc_error_string(error), shutdown_initiated_);
this, grpc_error_std_string(error).c_str(), shutdown_initiated_);
have_next_resolution_timer_ = false;
if (error == GRPC_ERROR_NONE && !shutdown_initiated_) {
if (!resolving_) {
@ -354,7 +354,7 @@ void AresDnsResolver::OnResolvedLocked(grpc_error_handle error) {
backoff_.Reset();
} else {
GRPC_CARES_TRACE_LOG("resolver:%p dns resolution failed: %s", this,
grpc_error_string(error));
grpc_error_std_string(error).c_str());
std::string error_message =
absl::StrCat("DNS resolution failed for service: ", name_to_resolve_);
result_handler_->ReturnError(grpc_error_set_int(
@ -365,7 +365,7 @@ void AresDnsResolver::OnResolvedLocked(grpc_error_handle error) {
grpc_millis next_try = backoff_.NextAttemptTime();
grpc_millis timeout = next_try - ExecCtx::Get()->Now();
GRPC_CARES_TRACE_LOG("resolver:%p dns resolution failed (will retry): %s",
this, grpc_error_string(error));
this, grpc_error_std_string(error).c_str());
GPR_ASSERT(!have_next_resolution_timer_);
have_next_resolution_timer_ = true;
// TODO(roth): We currently deal with this ref manually. Once the

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

@ -273,7 +273,8 @@ static void on_timeout_locked(grpc_ares_ev_driver* driver,
GRPC_CARES_TRACE_LOG(
"request:%p ev_driver=%p on_timeout_locked. driver->shutting_down=%d. "
"err=%s",
driver->request, driver, driver->shutting_down, grpc_error_string(error));
driver->request, driver, driver->shutting_down,
grpc_error_std_string(error).c_str());
if (!driver->shutting_down && error == GRPC_ERROR_NONE) {
grpc_ares_ev_driver_shutdown_locked(driver);
}
@ -315,7 +316,8 @@ static void on_ares_backup_poll_alarm_locked(grpc_ares_ev_driver* driver,
"request:%p ev_driver=%p on_ares_backup_poll_alarm_locked. "
"driver->shutting_down=%d. "
"err=%s",
driver->request, driver, driver->shutting_down, grpc_error_string(error));
driver->request, driver, driver->shutting_down,
grpc_error_std_string(error).c_str());
if (!driver->shutting_down && error == GRPC_ERROR_NONE) {
fd_node* fdn = driver->fds;
while (fdn != nullptr) {

@ -194,7 +194,7 @@ void NativeDnsResolver::OnResolvedLocked(grpc_error_handle error) {
backoff_.Reset();
} else {
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
// Return transient error.
std::string error_message =
absl::StrCat("DNS resolution failed for service: ", name_to_resolve_);

@ -185,7 +185,7 @@ void GoogleCloud2ProdResolver::ZoneQuery::OnDone(
grpc_error_handle error) {
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "error fetching zone from metadata server: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
}
std::string zone;
if (error == GRPC_ERROR_NONE && response->status == 200) {
@ -218,7 +218,7 @@ void GoogleCloud2ProdResolver::IPv6Query::OnDone(
grpc_error_handle error) {
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "error fetching IPv6 address from metadata server: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
}
resolver->IPv6QueryDone(error == GRPC_ERROR_NONE && response->status == 200);
GRPC_ERROR_UNREF(error);

@ -723,7 +723,7 @@ void XdsResolver::StartLocked() {
gpr_log(GPR_ERROR,
"Failed to create xds client -- channel will remain in "
"TRANSIENT_FAILURE: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
result_handler_->ReturnError(error);
return;
}
@ -822,7 +822,7 @@ void XdsResolver::OnRouteConfigUpdate(XdsApi::RdsUpdate rds_update) {
void XdsResolver::OnError(grpc_error_handle error) {
gpr_log(GPR_ERROR, "[xds_resolver %p] received error from XdsClient: %s",
this, grpc_error_string(error));
this, grpc_error_std_string(error).c_str());
Result result;
result.args = grpc_channel_args_copy(args_);
result.service_config_error = error;

@ -604,7 +604,8 @@ class RetryFilter::CallData::Canceller {
gpr_log(GPR_INFO,
"calld=%p: cancelling retry timer: error=%s self=%p "
"calld->canceller_=%p",
calld, grpc_error_string(error), self, calld->canceller_);
calld, grpc_error_std_string(error).c_str(), self,
calld->canceller_);
}
if (calld->canceller_ == self && error != GRPC_ERROR_NONE) {
calld->canceller_ = nullptr; // Checked by OnRetryTimer().
@ -1107,7 +1108,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvInitialMetadataReady(
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: got recv_initial_metadata_ready, error=%s",
calld->chand_, calld, grpc_error_string(error));
calld->chand_, calld, grpc_error_std_string(error).c_str());
}
call_attempt->completed_recv_initial_metadata_ = true;
// If a retry was already dispatched, then we're not going to use the
@ -1194,7 +1195,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvMessageReady(
CallData* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: got recv_message_ready, error=%s",
calld->chand_, calld, grpc_error_string(error));
calld->chand_, calld, grpc_error_std_string(error).c_str());
}
++call_attempt->completed_recv_message_count_;
// If a retry was already dispatched, then we're not going to use the
@ -1383,7 +1384,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvTrailingMetadataReady(
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: got recv_trailing_metadata_ready, error=%s",
calld->chand_, calld, grpc_error_string(error));
calld->chand_, calld, grpc_error_std_string(error).c_str());
}
call_attempt->completed_recv_trailing_metadata_ = true;
// Get the call's status and check for server pushback metadata.
@ -1491,7 +1492,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::OnComplete(
CallData* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: got on_complete, error=%s, batch=%s",
calld->chand_, calld, grpc_error_string(error),
calld->chand_, calld, grpc_error_std_string(error).c_str(),
grpc_transport_stream_op_batch_string(&batch_data->batch_).c_str());
}
// Update bookkeeping in call_attempt.
@ -1580,7 +1581,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::
retry_md, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS);
if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) {
gpr_log(GPR_ERROR, "error adding retry metadata: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
GPR_ASSERT(false);
}
}
@ -1780,7 +1781,7 @@ void RetryFilter::CallData::StartTransportStreamOpBatch(
grpc_error_handle cancel_error = 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_string(cancel_error));
this, grpc_error_std_string(cancel_error).c_str());
}
// If we have a current call attempt, commit the call, then send
// the cancellation down to that attempt. When the call fails, it
@ -2072,7 +2073,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_string(error));
chand_, this, num_batches, grpc_error_std_string(error).c_str());
}
CallCombinerClosureList closures;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {

@ -42,7 +42,8 @@ class ServiceConfigChannelArgChannelData {
if (service_config_error == GRPC_ERROR_NONE) {
service_config_ = std::move(service_config);
} else {
gpr_log(GPR_ERROR, "%s", grpc_error_string(service_config_error));
gpr_log(GPR_ERROR, "%s",
grpc_error_std_string(service_config_error).c_str());
}
GRPC_ERROR_UNREF(service_config_error);
}

@ -156,8 +156,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 != GRPC_ERROR_NONE)) {
const char* error_string = grpc_error_string(*error);
gpr_log(GPR_ERROR, "error: %s", error_string);
gpr_log(GPR_ERROR, "error: %s", grpc_error_std_string(*error).c_str());
return;
}
grpc_call_stack_set_pollset_or_pollset_set(callstk, args.pollent);
@ -1010,7 +1009,8 @@ void Subchannel::OnConnectingFinished(void* arg, grpc_error_handle error) {
c->PublishTransportLocked()) {
// Do nothing, transport was published.
} else if (!c->disconnected_) {
gpr_log(GPR_INFO, "Connect failed: %s", grpc_error_string(error));
gpr_log(GPR_INFO, "Connect failed: %s",
grpc_error_std_string(error).c_str());
c->SetConnectivityStateLocked(GRPC_CHANNEL_TRANSIENT_FAILURE,
grpc_error_to_absl_status(error));
}
@ -1047,7 +1047,7 @@ bool Subchannel::PublishTransportLocked() {
if (error != GRPC_ERROR_NONE) {
grpc_transport_destroy(connecting_result_.transport);
gpr_log(GPR_ERROR, "error initializing subchannel stack: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
return false;
}

@ -214,7 +214,7 @@ class CallData::ResumeBatchCanceller {
gpr_log(GPR_INFO,
"chand=%p calld=%p: cancelling schdueled pick: "
"error=%s self=%p calld->resume_batch_canceller_=%p",
chand, calld, grpc_error_string(error), self,
chand, calld, grpc_error_std_string(error).c_str(), self,
calld->resume_batch_canceller_);
}
if (error != GRPC_ERROR_NONE && calld->resume_batch_canceller_ == self) {

@ -264,7 +264,7 @@ void Chttp2ServerListener::ConfigFetcherWatcher::UpdateConnectionManager(
if (error != GRPC_ERROR_NONE) {
GRPC_ERROR_UNREF(error);
gpr_log(GPR_ERROR, "Error adding port to server: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
// TODO(yashykt): We wouldn't need to assert here if we bound to the
// port earlier during AddPort.
GPR_ASSERT(0);
@ -385,8 +385,8 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
{
MutexLock connection_lock(&self->connection_->mu_);
if (error != GRPC_ERROR_NONE || self->connection_->shutdown_) {
const char* error_str = grpc_error_string(error);
gpr_log(GPR_DEBUG, "Handshaking failed: %s", error_str);
std::string error_str = grpc_error_std_string(error);
gpr_log(GPR_DEBUG, "Handshaking failed: %s", error_str.c_str());
cleanup_connection = true;
free_resource_quota = true;
if (error == GRPC_ERROR_NONE && args->endpoint != nullptr) {
@ -455,7 +455,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_string(channel_init_err));
grpc_error_std_string(channel_init_err).c_str());
GRPC_ERROR_UNREF(channel_init_err);
grpc_transport_destroy(transport);
grpc_slice_buffer_destroy_internal(args->read_buffer);
@ -735,7 +735,8 @@ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
grpc_error_handle error = GRPC_ERROR_NONE;
args = self->args_modifier_(*args_result, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_DEBUG, "Closing connection: %s", grpc_error_string(error));
gpr_log(GPR_DEBUG, "Closing connection: %s",
grpc_error_std_string(error).c_str());
endpoint_cleanup(error);
grpc_channel_args_destroy(args);
return;
@ -877,7 +878,7 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
resolved->naddrs - error_list.size(), resolved->naddrs);
error = GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(
msg.c_str(), error_list.data(), error_list.size());
gpr_log(GPR_INFO, "WARNING: %s", grpc_error_string(error));
gpr_log(GPR_INFO, "WARNING: %s", grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
// we managed to bind some addresses: continue without error
}

@ -46,8 +46,7 @@ int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) {
grpc_channel_args_copy(server->core_server->channel_args()),
ModifyArgsForConnection, &port_num);
if (err != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg);
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(err).c_str());
GRPC_ERROR_UNREF(err);
}

@ -60,7 +60,7 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
} else {
gpr_log(GPR_ERROR, "Failed to create channel: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
grpc_transport_destroy(transport);
}

@ -121,8 +121,7 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
done:
sc.reset(DEBUG_LOCATION, "server");
if (err != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg);
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(err).c_str());
GRPC_ERROR_UNREF(err);
}

@ -1104,7 +1104,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_string(t->goaway_error));
goaway_error, grpc_error_std_string(t->goaway_error).c_str());
}
absl::Status status = grpc_error_to_absl_status(t->goaway_error);
// When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
@ -1220,7 +1220,6 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
}
closure->next_data.scratch -= CLOSURE_BARRIER_FIRST_REF_BIT;
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
const char* errstr = grpc_error_string(error);
gpr_log(
GPR_INFO,
"complete_closure_step: t=%p %p refs=%d flags=0x%04x desc=%s err=%s "
@ -1230,7 +1229,8 @@ 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, errstr, write_state_name(t->write_state));
desc, grpc_error_std_string(error).c_str(),
write_state_name(t->write_state));
}
if (error != GRPC_ERROR_NONE) {
if (closure->error_data.error == GRPC_ERROR_NONE) {
@ -1752,7 +1752,7 @@ void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error) {
// We want to log this irrespective of whether http tracing is enabled
gpr_log(GPR_INFO, "%s: Sending goaway err=%s", t->peer_string.c_str(),
grpc_error_string(error));
grpc_error_std_string(error).c_str());
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
grpc_http2_error_code http_error;
grpc_slice slice;
@ -2627,7 +2627,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_string(error));
grpc_error_std_string(error).c_str());
}
if (error != GRPC_ERROR_NONE || t->closed_with_error != GRPC_ERROR_NONE) {
return;
@ -2651,7 +2651,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_string(error));
grpc_error_std_string(error).c_str());
}
if (error != GRPC_ERROR_NONE || t->closed_with_error != GRPC_ERROR_NONE) {
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");

@ -772,8 +772,7 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
return err;
} else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, &unused)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg);
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(err).c_str());
}
grpc_chttp2_parsing_become_skip_parser(t);
if (s) {

@ -889,7 +889,8 @@ 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_string(error));
INPROC_LOG(GPR_INFO, "cancel_stream %p with %s", s,
grpc_error_std_string(error).c_str());
if (s->cancel_self_error == GRPC_ERROR_NONE) {
ret = true;
s->cancel_self_error = GRPC_ERROR_REF(error);
@ -1303,7 +1304,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
if (error != GRPC_ERROR_NONE) {
GPR_ASSERT(!channel);
gpr_log(GPR_ERROR, "Failed to create client channel: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, &integer)) {
@ -1318,7 +1319,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_string(error));
grpc_error_std_string(error).c_str());
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, &integer)) {

@ -1092,6 +1092,7 @@ grpc_slice XdsApi::CreateAdsRequest(
request, StdStringToUpbString(nonce));
}
// Set error_detail if it's a NACK.
std::string error_string_storage;
if (error != GRPC_ERROR_NONE) {
google_rpc_Status* error_detail =
envoy_service_discovery_v3_DiscoveryRequest_mutable_error_detail(
@ -1102,8 +1103,8 @@ grpc_slice XdsApi::CreateAdsRequest(
// generate them in the parsing code, and then use that here.
google_rpc_Status_set_code(error_detail, GRPC_STATUS_INVALID_ARGUMENT);
// Error description comes from the error that was passed in.
upb_strview error_description =
StdStringToUpbString(absl::string_view(grpc_error_string(error)));
error_string_storage = grpc_error_std_string(error);
upb_strview error_description = StdStringToUpbString(error_string_storage);
google_rpc_Status_set_message(error_detail, error_description);
GRPC_ERROR_UNREF(error);
}

@ -202,7 +202,7 @@ class XdsClient::ChannelState::AdsCallState
watcher_error, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
grpc_error_string(watcher_error));
grpc_error_std_string(watcher_error).c_str());
}
if (type_url_ == XdsApi::kLdsTypeUrl) {
ListenerState& state = ads_calld_->xds_client()->listener_map_[name_];
@ -829,7 +829,7 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
"error=%s resources=%s",
xds_client(), type_url.c_str(),
xds_client()->resource_version_map_[type_url].c_str(),
state.nonce.c_str(), grpc_error_string(state.error),
state.nonce.c_str(), grpc_error_std_string(state.error).c_str(),
absl::StrJoin(resource_names, " ").c_str());
}
GRPC_ERROR_UNREF(state.error);
@ -1214,7 +1214,7 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
// Ignore unparsable response.
gpr_log(GPR_ERROR,
"[xds_client %p] Error parsing ADS response (%s) -- ignoring",
xds_client(), grpc_error_string(result.parse_error));
xds_client(), grpc_error_std_string(result.parse_error).c_str());
GRPC_ERROR_UNREF(result.parse_error);
} else {
grpc_millis update_time = grpc_core::ExecCtx::Get()->Now();
@ -1232,7 +1232,8 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
"[xds_client %p] ADS response invalid for resource type %s "
"version %s, will NACK: nonce=%s error=%s",
xds_client(), result.type_url.c_str(), result.version.c_str(),
state.nonce.c_str(), grpc_error_string(result.parse_error));
state.nonce.c_str(),
grpc_error_std_string(result.parse_error).c_str());
SendMessageLocked(result.type_url);
} else {
seen_response_ = true;
@ -1296,7 +1297,7 @@ void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
"[xds_client %p] ADS call status received. Status = %d, details "
"= '%s', (chand: %p, ads_calld: %p, call: %p), error '%s'",
xds_client(), status_code_, status_details, chand(), this, call_,
grpc_error_string(error));
grpc_error_std_string(error).c_str());
gpr_free(status_details);
}
// Ignore status from a stale call.
@ -1659,7 +1660,7 @@ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
if (parse_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"[xds_client %p] LRS response parsing failed. error=%s",
xds_client(), grpc_error_string(parse_error));
xds_client(), grpc_error_std_string(parse_error).c_str());
GRPC_ERROR_UNREF(parse_error);
return;
}
@ -1746,7 +1747,7 @@ void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
"[xds_client %p] LRS call status received. Status = %d, details "
"= '%s', (chand: %p, calld: %p, call: %p), error '%s'",
xds_client(), status_code_, status_details, chand(), this, call_,
grpc_error_string(error));
grpc_error_std_string(error).c_str());
gpr_free(status_details);
}
// Ignore status from a stale call.
@ -2255,7 +2256,7 @@ void XdsClient::UpdateResourceMetadataWithFailedParseResultLocked(
grpc_millis update_time, const XdsApi::AdsParseResult& result) {
// ADS update is rejected and the resource names in the failed update is
// available.
absl::string_view details = grpc_error_string(result.parse_error);
std::string details = grpc_error_std_string(result.parse_error);
for (auto& name : result.resource_names_failed) {
XdsApi::ResourceMetadata* resource_metadata = nullptr;
if (result.type_url == XdsApi::kLdsTypeUrl) {
@ -2284,7 +2285,7 @@ void XdsClient::UpdateResourceMetadataWithFailedParseResultLocked(
}
resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
resource_metadata->failed_version = result.version;
resource_metadata->failed_details = std::string(details);
resource_metadata->failed_details = details;
resource_metadata->failed_update_time = update_time;
}
}

@ -453,18 +453,20 @@ class XdsServerConfigFetcher : public grpc_server_config_fetcher {
gpr_log(GPR_ERROR,
"ListenerWatcher:%p XdsClient reports error: %s for %s; "
"ignoring in favor of existing resource",
this, grpc_error_string(error), listening_address_.c_str());
this, grpc_error_std_string(error).c_str(),
listening_address_.c_str());
} else {
if (serving_status_notifier_.on_serving_status_change != nullptr) {
serving_status_notifier_.on_serving_status_change(
serving_status_notifier_.user_data, listening_address_.c_str(),
GRPC_STATUS_UNAVAILABLE, grpc_error_string(error));
GRPC_STATUS_UNAVAILABLE, grpc_error_std_string(error).c_str());
} else {
gpr_log(
GPR_ERROR,
"ListenerWatcher:%p error obtaining xDS Listener resource: %s; "
"not serving on %s",
this, grpc_error_string(error), listening_address_.c_str());
this, grpc_error_std_string(error).c_str(),
listening_address_.c_str());
}
}
GRPC_ERROR_UNREF(error);
@ -528,7 +530,7 @@ grpc_server_config_fetcher* grpc_server_config_fetcher_xds_create(
grpc_core::XdsClient::GetOrCreate(args, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Failed to create xds client: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
return nullptr;
}

@ -88,7 +88,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_string(error), is_shutdown_, index_,
this, grpc_error_std_string(error).c_str(), is_shutdown_, index_,
HandshakerArgsString(&args_).c_str());
}
GPR_ASSERT(index_ <= handshakers_.size());
@ -121,7 +121,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_string(error));
this, grpc_error_std_string(error).c_str());
}
// Cancel deadline timer, since we're invoking the on_handshake_done
// callback now.

@ -169,9 +169,8 @@ static void on_handshake_done(void* arg, grpc_error_handle error) {
auto* args = static_cast<grpc_core::HandshakerArgs*>(arg);
on_done_closure* c = static_cast<on_done_closure*>(args->user_data);
if (error != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(error);
gpr_log(GPR_ERROR, "Secure transport setup failed: %s", msg);
gpr_log(GPR_ERROR, "Secure transport setup failed: %s",
grpc_error_std_string(error).c_str());
c->func(c->arg, nullptr);
} else {
grpc_channel_args_destroy(args->args);

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

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

@ -120,8 +120,7 @@ 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;
const char* str = grpc_error_string(error);
gpr_log(GPR_DEBUG, "read: error=%s", str);
gpr_log(GPR_DEBUG, "read: error=%s", grpc_error_std_string(error).c_str());
for (i = 0; i < ep->read_slices->count; i++) {
char* dump = grpc_dump_slice(ep->read_slices->slices[i],
@ -141,8 +140,7 @@ 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);
const char* str = grpc_error_string(error);
gpr_log(GPR_DEBUG, "write: error=%s", str);
gpr_log(GPR_DEBUG, "write: error=%s", grpc_error_std_string(error).c_str());
}
grpc_closure* cb = ep->write_cb;
ep->write_cb = nullptr;

@ -777,6 +777,10 @@ const char* grpc_error_string(grpc_error_handle err) {
return out;
}
std::string grpc_error_std_string(grpc_error_handle error) {
return std::string(grpc_error_string(error));
}
grpc_error_handle grpc_os_error(const char* file, int line, int err,
const char* call_name) {
return grpc_error_set_str(

@ -134,7 +134,9 @@ inline bool grpc_error_is_special(grpc_error_handle err) {
void grpc_disable_error_creation();
void grpc_enable_error_creation();
// DEPRECATED: Use grpc_error_std_string instead
const char* grpc_error_string(grpc_error_handle error);
std::string grpc_error_std_string(grpc_error_handle error);
/// Create an error - but use GRPC_ERROR_CREATE instead
grpc_error_handle grpc_error_create(const char* file, int line,

@ -167,7 +167,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_string(shutdown_error));
&state_, curr, grpc_error_std_string(shutdown_error).c_str());
}
switch (curr) {
case kClosureReady:

@ -55,7 +55,7 @@ bool grpc_parse_unix(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixSockaddrPopulate(uri.path(), resolved_addr);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "%s", grpc_error_string(error));
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
return false;
}
@ -72,7 +72,7 @@ bool grpc_parse_unix_abstract(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixAbstractSockaddrPopulate(uri.path(), resolved_addr);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "%s", grpc_error_string(error));
gpr_log(GPR_ERROR, "%s", grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
return false;
}

@ -64,9 +64,8 @@ static void on_alarm(void* acp, grpc_error_handle error) {
grpc_custom_socket* socket = static_cast<grpc_custom_socket*>(acp);
grpc_custom_tcp_connect* connect = socket->connector;
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "CLIENT_CONNECT: %s: on_alarm: error=%s",
connect->addr_name.c_str(), str);
connect->addr_name.c_str(), grpc_error_std_string(error).c_str());
}
if (error == GRPC_ERROR_NONE) {
/* error == NONE implies that the timer ran out, and wasn't cancelled. If

@ -104,9 +104,8 @@ static void tc_on_alarm(void* acp, grpc_error_handle error) {
int done;
async_connect* ac = static_cast<async_connect*>(acp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "CLIENT_CONNECT: %s: on_alarm: error=%s",
ac->addr_str.c_str(), str);
ac->addr_str.c_str(), grpc_error_std_string(error).c_str());
}
gpr_mu_lock(&ac->mu);
if (ac->fd != nullptr) {
@ -140,9 +139,8 @@ static void on_writable(void* acp, grpc_error_handle error) {
GRPC_ERROR_REF(error);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "CLIENT_CONNECT: %s: on_writable: error=%s",
ac->addr_str.c_str(), str);
ac->addr_str.c_str(), grpc_error_std_string(error).c_str());
}
gpr_mu_lock(&ac->mu);

@ -128,9 +128,7 @@ static void call_read_cb(custom_tcp_endpoint* tcp, grpc_error_handle error) {
gpr_log(GPR_INFO, "TCP:%p call_cb %p %p:%p", tcp->socket, cb, cb->cb,
cb->cb_arg);
size_t i;
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "read: error=%s", str);
gpr_log(GPR_INFO, "read: error=%s", grpc_error_std_string(error).c_str());
for (i = 0; i < tcp->read_slices->count; i++) {
char* dump = grpc_dump_slice(tcp->read_slices->slices[i],
GPR_DUMP_HEX | GPR_DUMP_ASCII);
@ -175,7 +173,7 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error_handle error) {
custom_tcp_endpoint* tcp = static_cast<custom_tcp_endpoint*>(tcpp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "TCP:%p read_allocation_done: %s", tcp->socket,
grpc_error_string(error));
grpc_error_std_string(error).c_str());
}
if (error == GRPC_ERROR_NONE) {
/* Before calling read, we allocate a buffer with exactly one slice
@ -191,8 +189,8 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error_handle error) {
call_read_cb(tcp, GRPC_ERROR_REF(error));
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "Initiating read on %p: error=%s", tcp->socket, str);
gpr_log(GPR_INFO, "Initiating read on %p: error=%s", tcp->socket,
grpc_error_std_string(error).c_str());
}
}
@ -221,8 +219,8 @@ static void custom_write_callback(grpc_custom_socket* socket,
grpc_closure* cb = tcp->write_cb;
tcp->write_cb = nullptr;
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "write complete on %p: error=%s", tcp->socket, str);
gpr_log(GPR_INFO, "write complete on %p: error=%s", tcp->socket,
grpc_error_std_string(error).c_str());
}
TCP_UNREF(tcp, "write");
grpc_core::ExecCtx::Run(DEBUG_LOCATION, cb, error);
@ -291,8 +289,8 @@ static void endpoint_shutdown(grpc_endpoint* ep, grpc_error_handle why) {
custom_tcp_endpoint* tcp = reinterpret_cast<custom_tcp_endpoint*>(ep);
if (!tcp->shutting_down) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
const char* str = grpc_error_string(why);
gpr_log(GPR_INFO, "TCP %p shutdown why=%s", tcp->socket, str);
gpr_log(GPR_INFO, "TCP %p shutdown why=%s", tcp->socket,
grpc_error_std_string(why).c_str());
}
tcp->shutting_down = true;
// grpc_core::ExecCtx::Run(DEBUG_LOCATION,tcp->read_cb,

@ -563,7 +563,8 @@ static void notify_on_write(grpc_tcp* tcp) {
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_string(error));
gpr_log(GPR_INFO, "TCP:%p got_write: %s", arg,
grpc_error_std_string(error).c_str());
}
drop_uncovered(static_cast<grpc_tcp*>(arg));
tcp_handle_write(arg, error);
@ -686,10 +687,8 @@ static void call_read_cb(grpc_tcp* tcp, grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "TCP:%p call_cb %p %p:%p", tcp, cb, cb->cb, cb->cb_arg);
size_t i;
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "READ %p (peer=%s) error=%s", tcp,
tcp->peer_string.c_str(), str);
tcp->peer_string.c_str(), grpc_error_std_string(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],
@ -856,7 +855,7 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error_handle error) {
grpc_tcp* tcp = static_cast<grpc_tcp*>(tcpp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "TCP:%p read_allocation_done: %s", tcp,
grpc_error_string(error));
grpc_error_std_string(error).c_str());
}
if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) {
grpc_slice_buffer_reset_and_unref_internal(tcp->incoming_buffer);
@ -892,7 +891,8 @@ static void tcp_continue_read(grpc_tcp* tcp) {
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_string(error));
gpr_log(GPR_INFO, "TCP:%p got_read: %s", tcp,
grpc_error_std_string(error).c_str());
}
if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) {
@ -1219,7 +1219,8 @@ static void tcp_handle_error(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_error: %s", tcp, grpc_error_string(error));
gpr_log(GPR_INFO, "TCP:%p got_error: %s", tcp,
grpc_error_std_string(error).c_str());
}
if (error != GRPC_ERROR_NONE ||
@ -1553,8 +1554,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)) {
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "write: %s", str);
gpr_log(GPR_INFO, "write: %s", grpc_error_std_string(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);
@ -1622,8 +1622,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)) {
const char* str = grpc_error_string(error);
gpr_log(GPR_INFO, "write: %s", str);
gpr_log(GPR_INFO, "write: %s", grpc_error_std_string(error).c_str());
}
grpc_core::Closure::Run(DEBUG_LOCATION, cb, error);
}

@ -256,7 +256,8 @@ static void custom_accept_callback(grpc_custom_socket* socket,
grpc_tcp_listener* sp = socket->listener;
if (error != GRPC_ERROR_NONE) {
if (!sp->closed) {
gpr_log(GPR_ERROR, "Accept failed: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "Accept failed: %s",
grpc_error_std_string(error).c_str());
}
gpr_free(client);
GRPC_ERROR_UNREF(error);
@ -392,7 +393,7 @@ static grpc_error_handle tcp_server_add_port(grpc_tcp_server* s,
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "SERVER %p add_port %s error=%s", s,
grpc_sockaddr_to_string(addr, false).c_str(),
grpc_error_string(error));
grpc_error_std_string(error).c_str());
}
family = grpc_sockaddr_get_family(addr);

@ -325,14 +325,14 @@ 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_string(v6_err));
grpc_error_std_string(v6_err).c_str());
GRPC_ERROR_UNREF(v6_err);
}
if (v4_err != GRPC_ERROR_NONE) {
gpr_log(GPR_INFO,
"Failed to add 0.0.0.0 listener, "
"the environment may not support IPv4: %s",
grpc_error_string(v4_err));
grpc_error_std_string(v4_err).c_str());
GRPC_ERROR_UNREF(v4_err);
}
return GRPC_ERROR_NONE;

@ -318,8 +318,8 @@ static void on_accept(void* arg, grpc_error_handle error) {
this is necessary in the read/write case, it's useless for the accept
case. We only need to adjust the pending callback count */
if (error != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(error);
gpr_log(GPR_INFO, "Skipping on_accept due to error: %s", msg);
gpr_log(GPR_INFO, "Skipping on_accept due to error: %s",
grpc_error_std_string(error).c_str());
gpr_mu_unlock(&sp->server->mu);
return;

@ -302,7 +302,7 @@ absl::StatusOr<RbacPolicies> GenerateRbacPolicies(
if (error != GRPC_ERROR_NONE) {
absl::Status status = absl::InvalidArgumentError(
absl::StrCat("Failed to parse SDK authorization policy. Error: ",
grpc_error_string(error)));
grpc_error_std_string(error)));
GRPC_ERROR_UNREF(error);
return status;
}

@ -481,7 +481,7 @@ grpc_call_credentials* grpc_external_account_credentials_create(
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"External account credentials creation failed. Error: %s.",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
return nullptr;
}
@ -492,7 +492,7 @@ grpc_call_credentials* grpc_external_account_credentials_create(
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"External account credentials creation failed. Error: %s.",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
return nullptr;
}

@ -373,7 +373,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_string(error));
grpc_error_std_string(error).c_str());
}
GRPC_ERROR_UNREF(error);
return result;

@ -90,7 +90,8 @@ static Json parse_json_part_from_jwt(const char* str, size_t len) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(string, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parse error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parse error: %s",
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
json = Json(); // JSON null
}

@ -97,7 +97,8 @@ grpc_auth_refresh_token grpc_auth_refresh_token_create_from_string(
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_string, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parsing failed: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parsing failed: %s",
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
}
return grpc_auth_refresh_token_create_from_json(json);
@ -168,7 +169,7 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
json = Json::Parse(null_terminated_body, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Could not parse JSON from %s: %s",
null_terminated_body, grpc_error_string(error));
null_terminated_body, grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
status = GRPC_CREDENTIALS_ERROR;
goto end;
@ -685,7 +686,8 @@ 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_string(grpc_error_vec));
auto retval =
absl::InvalidArgumentError(grpc_error_std_string(grpc_error_vec));
GRPC_ERROR_UNREF(grpc_error_vec);
return retval;
}

@ -261,7 +261,8 @@ FileWatcherCertificateProvider::ReadRootCertificatesFromFile(
grpc_load_file(root_cert_full_path.c_str(), 0, &root_slice);
if (root_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Reading file %s failed: %s",
root_cert_full_path.c_str(), grpc_error_string(root_error));
root_cert_full_path.c_str(),
grpc_error_std_string(root_error).c_str());
GRPC_ERROR_UNREF(root_error);
return absl::nullopt;
}
@ -319,7 +320,8 @@ FileWatcherCertificateProvider::ReadIdentityKeyCertPairFromFiles(
grpc_load_file(private_key_path.c_str(), 0, &key_slice.slice);
if (key_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Reading file %s failed: %s. Start retrying...",
private_key_path.c_str(), grpc_error_string(key_error));
private_key_path.c_str(),
grpc_error_std_string(key_error).c_str());
GRPC_ERROR_UNREF(key_error);
continue;
}
@ -327,7 +329,8 @@ FileWatcherCertificateProvider::ReadIdentityKeyCertPairFromFiles(
grpc_load_file(identity_certificate_path.c_str(), 0, &cert_slice.slice);
if (cert_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Reading file %s failed: %s. Start retrying...",
identity_certificate_path.c_str(), grpc_error_string(cert_error));
identity_certificate_path.c_str(),
grpc_error_std_string(cert_error).c_str());
GRPC_ERROR_UNREF(cert_error);
continue;
}

@ -363,12 +363,12 @@ void TlsChannelSecurityConnector::TlsChannelCertificateWatcher::OnError(
if (root_cert_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"TlsChannelCertificateWatcher getting root_cert_error: %s",
grpc_error_string(root_cert_error));
grpc_error_std_string(root_cert_error).c_str());
}
if (identity_cert_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"TlsChannelCertificateWatcher getting identity_cert_error: %s",
grpc_error_string(identity_cert_error));
grpc_error_std_string(identity_cert_error).c_str());
}
GRPC_ERROR_UNREF(root_cert_error);
GRPC_ERROR_UNREF(identity_cert_error);
@ -621,12 +621,12 @@ void TlsServerSecurityConnector::TlsServerCertificateWatcher::OnError(
if (root_cert_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"TlsServerCertificateWatcher getting root_cert_error: %s",
grpc_error_string(root_cert_error));
grpc_error_std_string(root_cert_error).c_str());
}
if (identity_cert_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"TlsServerCertificateWatcher getting identity_cert_error: %s",
grpc_error_string(identity_cert_error));
grpc_error_std_string(identity_cert_error).c_str());
}
GRPC_ERROR_UNREF(root_cert_error);
GRPC_ERROR_UNREF(identity_cert_error);

@ -180,9 +180,8 @@ void SecurityHandshaker::HandshakeFailedLocked(grpc_error_handle error) {
// endpoint callback was invoked, we need to generate our own error.
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Handshaker shutdown");
}
const char* msg = grpc_error_string(error);
gpr_log(GPR_DEBUG, "Security handshake failed: %s", msg);
gpr_log(GPR_DEBUG, "Security handshake failed: %s",
grpc_error_std_string(error).c_str());
if (!is_shutdown_) {
tsi_handshaker_shutdown(handshaker_);
// TODO(ctiller): It is currently necessary to shutdown endpoints

@ -310,7 +310,7 @@ static grpc_error_handle server_auth_init_channel_elem(
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No authorization context found. This might be a TRANSIENT failure due "
"to certificates not having been loaded yet.");
gpr_log(GPR_DEBUG, "%s", grpc_error_string(error));
gpr_log(GPR_DEBUG, "%s", grpc_error_std_string(error).c_str());
return error;
}
GPR_ASSERT(auth_context != nullptr);

@ -743,7 +743,7 @@ static void cancel_with_status(grpc_call* c, grpc_status_code status,
static void set_final_status(grpc_call* call, grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_error_trace)) {
gpr_log(GPR_DEBUG, "set_final_status %s", call->is_client ? "CLI" : "SVR");
gpr_log(GPR_DEBUG, "%s", grpc_error_string(error));
gpr_log(GPR_DEBUG, "%s", grpc_error_std_string(error).c_str());
}
if (call->is_client) {
grpc_error_get_status(error, call->send_deadline,

@ -75,7 +75,7 @@ grpc_channel* grpc_channel_create_with_builder(
reinterpret_cast<void**>(&channel));
if (builder_error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "channel stack builder failed: %s",
grpc_error_string(builder_error));
grpc_error_std_string(builder_error).c_str());
GPR_ASSERT(channel == nullptr);
if (error != nullptr) {
*error = builder_error;

@ -698,14 +698,15 @@ static void cq_end_op_for_next(
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) ||
(GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) &&
error != GRPC_ERROR_NONE)) {
const char* errmsg = grpc_error_string(error);
std::string errmsg = grpc_error_std_string(error);
GRPC_API_TRACE(
"cq_end_op_for_next(cq=%p, tag=%p, error=%s, "
"done=%p, done_arg=%p, storage=%p)",
6, (cq, tag, errmsg, done, done_arg, storage));
6, (cq, tag, errmsg.c_str(), done, done_arg, storage));
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) &&
error != GRPC_ERROR_NONE) {
gpr_log(GPR_INFO, "Operation failed: tag=%p, error=%s", tag, errmsg);
gpr_log(GPR_INFO, "Operation failed: tag=%p, error=%s", tag,
errmsg.c_str());
}
}
cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
@ -741,8 +742,8 @@ static void cq_end_op_for_next(
gpr_mu_unlock(cq->mu);
if (kick_error != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(kick_error);
gpr_log(GPR_ERROR, "Kick failed: %s", msg);
gpr_log(GPR_ERROR, "Kick failed: %s",
grpc_error_std_string(kick_error).c_str());
GRPC_ERROR_UNREF(kick_error);
}
}
@ -782,14 +783,15 @@ static void cq_end_op_for_pluck(
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) ||
(GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) &&
error != GRPC_ERROR_NONE)) {
const char* errmsg = grpc_error_string(error);
std::string errmsg = grpc_error_std_string(error).c_str();
GRPC_API_TRACE(
"cq_end_op_for_pluck(cq=%p, tag=%p, error=%s, "
"done=%p, done_arg=%p, storage=%p)",
6, (cq, tag, errmsg, done, done_arg, storage));
6, (cq, tag, errmsg.c_str(), done, done_arg, storage));
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) &&
error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Operation failed: tag=%p, error=%s", tag, errmsg);
gpr_log(GPR_ERROR, "Operation failed: tag=%p, error=%s", tag,
errmsg.c_str());
}
}
@ -822,13 +824,10 @@ static void cq_end_op_for_pluck(
grpc_error_handle kick_error =
cq->poller_vtable->kick(POLLSET_FROM_CQ(cq), pluck_worker);
gpr_mu_unlock(cq->mu);
if (kick_error != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(kick_error);
gpr_log(GPR_ERROR, "Kick failed: %s", msg);
gpr_log(GPR_ERROR, "Kick failed: %s",
grpc_error_std_string(kick_error).c_str());
GRPC_ERROR_UNREF(kick_error);
}
}
@ -853,14 +852,15 @@ static void cq_end_op_for_callback(
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) ||
(GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) &&
error != GRPC_ERROR_NONE)) {
const char* errmsg = grpc_error_string(error);
std::string errmsg = grpc_error_std_string(error);
GRPC_API_TRACE(
"cq_end_op_for_callback(cq=%p, tag=%p, error=%s, "
"done=%p, done_arg=%p, storage=%p)",
6, (cq, tag, errmsg, done, done_arg, storage));
6, (cq, tag, errmsg.c_str(), done, done_arg, storage));
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) &&
error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Operation failed: tag=%p, error=%s", tag, errmsg);
gpr_log(GPR_ERROR, "Operation failed: tag=%p, error=%s", tag,
errmsg.c_str());
}
}
@ -1062,9 +1062,8 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline,
gpr_mu_unlock(cq->mu);
if (err != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "Completion queue next failed: %s", msg);
gpr_log(GPR_ERROR, "Completion queue next failed: %s",
grpc_error_std_string(err).c_str());
GRPC_ERROR_UNREF(err);
ret.type = GRPC_QUEUE_TIMEOUT;
ret.success = 0;
@ -1305,9 +1304,8 @@ static grpc_event cq_pluck(grpc_completion_queue* cq, void* tag,
if (err != GRPC_ERROR_NONE) {
del_plucker(cq, tag, &worker);
gpr_mu_unlock(cq->mu);
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "Completion queue pluck failed: %s", msg);
gpr_log(GPR_ERROR, "Completion queue pluck failed: %s",
grpc_error_std_string(err).c_str());
GRPC_ERROR_UNREF(err);
ret.type = GRPC_QUEUE_TIMEOUT;
ret.success = 0;

@ -97,7 +97,7 @@ void grpc_error_get_status(grpc_error_handle error, grpc_millis deadline,
if (code != nullptr) *code = status;
if (error_string != nullptr && status != GRPC_STATUS_OK) {
*error_string = gpr_strdup(grpc_error_string(error));
*error_string = gpr_strdup(grpc_error_std_string(error).c_str());
}
if (http_error != nullptr) {

@ -109,7 +109,7 @@ std::string grpc_transport_stream_op_batch_string(
if (op->cancel_stream) {
out.push_back(absl::StrCat(
" CANCEL:",
grpc_error_string(op->payload->cancel_stream.cancel_error)));
grpc_error_std_string(op->payload->cancel_stream.cancel_error)));
}
return absl::StrJoin(out, "");
@ -131,13 +131,13 @@ std::string grpc_transport_op_string(grpc_transport_op* op) {
}
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
out.push_back(absl::StrCat(" DISCONNECT:",
grpc_error_string(op->disconnect_with_error)));
out.push_back(absl::StrCat(
" DISCONNECT:", grpc_error_std_string(op->disconnect_with_error)));
}
if (op->goaway_error) {
out.push_back(
absl::StrCat(" SEND_GOAWAY:%s", grpc_error_string(op->goaway_error)));
out.push_back(absl::StrCat(" SEND_GOAWAY:%s",
grpc_error_std_string(op->goaway_error)));
}
if (op->set_accept_stream) {

@ -451,7 +451,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_string(error));
grpc_error_std_string(error).c_str());
gpr_free(status_details);
}
maybe_complete_tsi_next(client, true /* receive_status_finished */,

@ -383,7 +383,7 @@ static void on_handshaker_service_resp_recv(void* arg,
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"ALTS handshaker on_handshaker_service_resp_recv error: %s",
grpc_error_string(error));
grpc_error_std_string(error).c_str());
success = false;
}
alts_handshaker_client_handle_response(client, success);

@ -232,7 +232,7 @@ grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options) {
error = grpc_load_file(sts_creds_path, 1, &json_string);
if (error != GRPC_ERROR_NONE) {
status =
grpc::Status(grpc::StatusCode::NOT_FOUND, grpc_error_string(error));
grpc::Status(grpc::StatusCode::NOT_FOUND, grpc_error_std_string(error));
return cleanup();
}
status = StsCredentialsOptionsFromJson(

@ -30,7 +30,7 @@ std::string ValidateServiceConfigJSON(const std::string& service_config_json) {
service_config_json.c_str(), &error);
std::string return_value;
if (error != GRPC_ERROR_NONE) {
return_value = grpc_error_string(error);
return_value = grpc_error_std_string(error);
GRPC_ERROR_UNREF(error);
}
grpc_shutdown();

@ -107,7 +107,7 @@ void ValidateGetTopChannels(size_t expected_channels) {
json_str.c_str());
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
// This check will naturally have to change when we support pagination.
// tracked: https://github.com/grpc/grpc/issues/16019.
@ -127,7 +127,7 @@ void ValidateGetServers(size_t expected_servers) {
json_str.c_str());
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
// This check will naturally have to change when we support pagination.
// tracked: https://github.com/grpc/grpc/issues/16019.
@ -209,7 +209,7 @@ void ValidateCounters(const std::string& json_str,
const ValidateChannelDataArgs& args) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(json.type(), Json::Type::OBJECT);
Json::Object* object = json.mutable_object();
Json& data = (*object)["data"];
@ -367,7 +367,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsPagination) {
json_str.c_str());
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
// 100 is the pagination limit.
ValidateJsonArraySize((*parsed_json.mutable_object())["channel"], 100);
@ -378,7 +378,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsPagination) {
json_str.c_str());
error = GRPC_ERROR_NONE;
parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
ValidateJsonArraySize((*parsed_json.mutable_object())["channel"], 50);
ValidateJsonEnd(parsed_json, true);
@ -392,7 +392,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsUuidCheck) {
std::string json_str = ChannelzRegistry::GetTopChannels(0);
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
Json& array = (*parsed_json.mutable_object())["channel"];
ValidateJsonArraySize(array, kNumChannels);
@ -412,7 +412,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMiddleUuidCheck) {
std::string json_str = ChannelzRegistry::GetTopChannels(kMidQuery);
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
Json& array = (*parsed_json.mutable_object())["channel"];
ValidateJsonArraySize(array, kNumChannels - kMidQuery + 1);
@ -434,7 +434,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsNoHitUuid) {
std::string json_str = ChannelzRegistry::GetTopChannels(45);
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
Json& array = (*parsed_json.mutable_object())["channel"];
ValidateJsonArraySize(array, 10);
@ -455,7 +455,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMoreGaps) {
std::string json_str = ChannelzRegistry::GetTopChannels(2);
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
Json array = (*parsed_json.mutable_object())["channel"];
ValidateJsonArraySize(array, 2);
@ -465,7 +465,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMoreGaps) {
json_str = ChannelzRegistry::GetTopChannels(4);
error = GRPC_ERROR_NONE;
parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
array = (*parsed_json.mutable_object())["channel"];
ValidateJsonArraySize(array, 1);
@ -488,7 +488,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsUuidAfterCompaction) {
std::string json_str = ChannelzRegistry::GetTopChannels(0);
grpc_error_handle error = GRPC_ERROR_NONE;
Json parsed_json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), Json::Type::OBJECT);
Json& array = (*parsed_json.mutable_object())["channel"];
ValidateJsonArraySize(array, kLoopIterations);

@ -213,7 +213,8 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler {
}
void ReturnError(grpc_error_handle error) override {
gpr_log(GPR_ERROR, "resolver returned error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "resolver returned error: %s",
grpc_error_std_string(error).c_str());
GPR_ASSERT(false);
}

@ -165,7 +165,7 @@ TEST_F(ServiceConfigTest, ErrorCheck1) {
const char* test_json = "";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex("JSON parse error"));
GRPC_ERROR_UNREF(error);
}
@ -174,7 +174,7 @@ TEST_F(ServiceConfigTest, BasicTest1) {
const char* test_json = "{}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
}
TEST_F(ServiceConfigTest, SkipMethodConfigWithNoNameOrEmptyName) {
@ -186,7 +186,7 @@ TEST_F(ServiceConfigTest, SkipMethodConfigWithNoNameOrEmptyName) {
"]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* vector_ptr = svc_cfg->GetMethodParsedConfigVector(
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
@ -203,7 +203,7 @@ TEST_F(ServiceConfigTest, ErrorDuplicateMethodConfigNames) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("Service config parsing error.*referenced_errors"
".*Method Params.*referenced_errors"
".*methodConfig.*referenced_errors"
@ -220,7 +220,7 @@ TEST_F(ServiceConfigTest, ErrorDuplicateMethodConfigNamesWithNullMethod) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("Service config parsing error.*referenced_errors"
".*Method Params.*referenced_errors"
".*methodConfig.*referenced_errors"
@ -237,7 +237,7 @@ TEST_F(ServiceConfigTest, ErrorDuplicateMethodConfigNamesWithEmptyMethod) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("Service config parsing error.*referenced_errors"
".*Method Params.*referenced_errors"
".*methodConfig.*referenced_errors"
@ -254,7 +254,7 @@ TEST_F(ServiceConfigTest, ErrorDuplicateDefaultMethodConfigs) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("Service config parsing error.*referenced_errors"
".*Method Params.*referenced_errors"
".*methodConfig.*referenced_errors"
@ -271,7 +271,7 @@ TEST_F(ServiceConfigTest, ErrorDuplicateDefaultMethodConfigsWithNullService) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("Service config parsing error.*referenced_errors"
".*Method Params.*referenced_errors"
".*methodConfig.*referenced_errors"
@ -288,7 +288,7 @@ TEST_F(ServiceConfigTest, ErrorDuplicateDefaultMethodConfigsWithEmptyService) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("Service config parsing error.*referenced_errors"
".*Method Params.*referenced_errors"
".*methodConfig.*referenced_errors"
@ -301,14 +301,14 @@ TEST_F(ServiceConfigTest, ValidMethodConfig) {
"{\"methodConfig\": [{\"name\":[{\"service\":\"TestServ\"}]}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
}
TEST_F(ServiceConfigTest, Parser1BasicTest1) {
const char* test_json = "{\"global_param\":5}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ((static_cast<TestParsedConfig1*>(svc_cfg->GetGlobalParsedConfig(0)))
->value(),
5);
@ -321,7 +321,7 @@ TEST_F(ServiceConfigTest, Parser1BasicTest2) {
const char* test_json = "{\"global_param\":1000}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ((static_cast<TestParsedConfig1*>(svc_cfg->GetGlobalParsedConfig(0)))
->value(),
1000);
@ -334,7 +334,7 @@ TEST_F(ServiceConfigTest, Parser1DisabledViaChannelArg) {
const char* test_json = "{\"global_param\":5}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(&args, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(svc_cfg->GetGlobalParsedConfig(0), nullptr);
}
@ -342,7 +342,7 @@ TEST_F(ServiceConfigTest, Parser1ErrorInvalidType) {
const char* test_json = "{\"global_param\":\"5\"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(absl::StrCat(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*",
@ -354,7 +354,7 @@ TEST_F(ServiceConfigTest, Parser1ErrorInvalidValue) {
const char* test_json = "{\"global_param\":-5}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(absl::StrCat(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*",
@ -368,7 +368,7 @@ TEST_F(ServiceConfigTest, Parser2BasicTest) {
"\"method_param\":5}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* vector_ptr = svc_cfg->GetMethodParsedConfigVector(
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
@ -385,7 +385,7 @@ TEST_F(ServiceConfigTest, Parser2DisabledViaChannelArg) {
"\"method_param\":5}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(&args, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* vector_ptr = svc_cfg->GetMethodParsedConfigVector(
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
@ -399,7 +399,7 @@ TEST_F(ServiceConfigTest, Parser2ErrorInvalidType) {
"\"method_param\":\"5\"}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(absl::StrCat(
"Service config parsing error.*referenced_errors\":\\[.*"
"Method Params.*referenced_errors.*methodConfig.*"
@ -414,7 +414,7 @@ TEST_F(ServiceConfigTest, Parser2ErrorInvalidValue) {
"\"method_param\":-5}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(absl::StrCat(
"Service config parsing error.*referenced_errors\":\\[.*"
"Method Params.*referenced_errors.*methodConfig.*"
@ -443,7 +443,7 @@ TEST_F(ErroredParsersScopingTest, GlobalParams) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex(absl::StrCat(
"Service config parsing error.*referenced_errors\":\\[.*"
"Global Params.*referenced_errors.*",
@ -456,7 +456,7 @@ TEST_F(ErroredParsersScopingTest, MethodParams) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex(absl::StrCat(
"Service config parsing error.*referenced_errors\":\\[.*"
"Global Params.*referenced_errors.*",
@ -487,7 +487,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigPickFirst) {
const char* test_json = "{\"loadBalancingConfig\": [{\"pick_first\":{}}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -500,7 +500,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigRoundRobin) {
"{\"loadBalancingConfig\": [{\"round_robin\":{}}, {}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -514,7 +514,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigGrpclb) {
"[{\"grpclb\":{\"childPolicy\":[{\"pick_first\":{}}]}}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -537,7 +537,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigXds) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -549,7 +549,7 @@ TEST_F(ClientChannelParserTest, UnknownLoadBalancingConfig) {
const char* test_json = "{\"loadBalancingConfig\": [{\"unknown\":{}}]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*"
@ -567,7 +567,7 @@ TEST_F(ClientChannelParserTest, InvalidGrpclbLoadBalancingConfig) {
"]}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*"
@ -583,7 +583,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingPolicy) {
const char* test_json = "{\"loadBalancingPolicy\":\"pick_first\"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -594,7 +594,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingPolicyAllCaps) {
const char* test_json = "{\"loadBalancingPolicy\":\"PICK_FIRST\"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -605,7 +605,7 @@ TEST_F(ClientChannelParserTest, UnknownLoadBalancingPolicy) {
const char* test_json = "{\"loadBalancingPolicy\":\"unknown\"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*"
@ -619,7 +619,7 @@ TEST_F(ClientChannelParserTest, LoadBalancingPolicyXdsNotAllowed) {
"{\"loadBalancingPolicy\":\"xds_cluster_resolver_experimental\"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*"
@ -642,7 +642,7 @@ TEST_F(ClientChannelParserTest, ValidTimeout) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* vector_ptr = svc_cfg->GetMethodParsedConfigVector(
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
@ -665,7 +665,7 @@ TEST_F(ClientChannelParserTest, InvalidTimeout) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -688,7 +688,7 @@ TEST_F(ClientChannelParserTest, ValidWaitForReady) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* vector_ptr = svc_cfg->GetMethodParsedConfigVector(
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
@ -717,7 +717,7 @@ TEST_F(ClientChannelParserTest, InvalidWaitForReady) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -736,7 +736,7 @@ TEST_F(ClientChannelParserTest, ValidHealthCheck) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -757,7 +757,7 @@ TEST_F(ClientChannelParserTest, InvalidHealthCheckMultipleEntries) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"JSON parsing failed.*referenced_errors.*"
"duplicate key \"healthCheckConfig\" at index 104"));
@ -789,7 +789,7 @@ TEST_F(RetryParserTest, ValidRetryThrottling) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::RetryGlobalConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
@ -806,7 +806,7 @@ TEST_F(RetryParserTest, RetryThrottlingMissingFields) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*"
@ -826,7 +826,7 @@ TEST_F(RetryParserTest, InvalidRetryThrottlingNegativeMaxTokens) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*"
@ -846,7 +846,7 @@ TEST_F(RetryParserTest, InvalidRetryThrottlingInvalidTokenRatio) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Global Params.*referenced_errors.*"
@ -874,7 +874,7 @@ TEST_F(RetryParserTest, ValidRetryPolicy) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* vector_ptr = svc_cfg->GetMethodParsedConfigVector(
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
@ -908,7 +908,7 @@ TEST_F(RetryParserTest, InvalidRetryPolicyMaxAttempts) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -936,7 +936,7 @@ TEST_F(RetryParserTest, InvalidRetryPolicyInitialBackoff) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -965,7 +965,7 @@ TEST_F(RetryParserTest, InvalidRetryPolicyMaxBackoff) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -994,7 +994,7 @@ TEST_F(RetryParserTest, InvalidRetryPolicyBackoffMultiplier) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -1022,7 +1022,7 @@ TEST_F(RetryParserTest, InvalidRetryPolicyRetryableStatusCodes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -1060,7 +1060,7 @@ TEST_F(MessageSizeParserTest, Valid) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* vector_ptr = svc_cfg->GetMethodParsedConfigVector(
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
@ -1083,7 +1083,7 @@ TEST_F(MessageSizeParserTest, InvalidMaxRequestMessageBytes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"
@ -1105,7 +1105,7 @@ TEST_F(MessageSizeParserTest, InvalidMaxResponseMessageBytes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"Service config parsing error.*referenced_errors.*"
"Method Params.*referenced_errors.*"

@ -118,7 +118,8 @@ static void handle_write() {
static void handle_read(void* /*arg*/, grpc_error_handle error) {
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "handle_read error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "handle_read error: %s",
grpc_error_std_string(error).c_str());
return;
}
state.incoming_data_length += state.temp_incoming_buffer.length;

@ -172,7 +172,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_string(error));
gpr_log(GPR_INFO, "%s: %s", prefix, grpc_error_std_string(error).c_str());
// Decide whether we should shut down the client and server.
bool shutdown_client = false;
bool shutdown_server = false;
@ -459,7 +459,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_string(error));
grpc_error_std_string(error).c_str());
if (error != GRPC_ERROR_NONE) {
proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy read request",
GRPC_ERROR_REF(error));

@ -48,7 +48,7 @@ static void on_finish(void* arg, grpc_error_handle error) {
grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
gpr_log(GPR_INFO, "response status=%d error=%s", response->status,
grpc_error_string(error));
grpc_error_std_string(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));

@ -51,7 +51,7 @@ static void on_finish(void* arg, grpc_error_handle error) {
grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
gpr_log(GPR_INFO, "response status=%d error=%s", response->status,
grpc_error_string(error));
grpc_error_std_string(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));

@ -145,7 +145,7 @@ static void print_error_string() {
error = grpc_error_set_int(error, GRPC_ERROR_INT_SIZE, 666);
error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE,
grpc_slice_from_static_string("message"));
// gpr_log(GPR_DEBUG, "%s", grpc_error_string(error));
// gpr_log(GPR_DEBUG, "%s", grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
}

@ -55,8 +55,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 != GRPC_ERROR_NONE);
const char* error_str = grpc_error_string(error);
NSLog(@"%s", error_str);
NSLog(@"%s", grpc_error_std_string(error).c_str());
finish_connection();
}

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

@ -77,7 +77,7 @@ void RunSuccessTest(const char* input, const Json& expected,
gpr_log(GPR_INFO, "parsing string \"%s\" - should succeed", input);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(input, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ValidateValue(json, expected);
std::string output = json.Dump();
EXPECT_EQ(output, expected_output);
@ -167,7 +167,7 @@ void RunParseFailureTest(const char* input) {
gpr_log(GPR_INFO, "parsing string \"%s\" - should fail", input);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(input, &error);
gpr_log(GPR_INFO, "error: %s", grpc_error_string(error));
gpr_log(GPR_INFO, "error: %s", grpc_error_std_string(error).c_str());
EXPECT_NE(error, GRPC_ERROR_NONE);
GRPC_ERROR_UNREF(error);
}

@ -446,8 +446,8 @@ static void check_metadata(const expected_md* expected,
static void check_request_metadata(void* arg, grpc_error_handle error) {
request_metadata_state* state = static_cast<request_metadata_state*>(arg);
gpr_log(GPR_INFO, "expected_error: %s",
grpc_error_string(state->expected_error));
gpr_log(GPR_INFO, "actual_error: %s", grpc_error_string(error));
grpc_error_std_string(state->expected_error).c_str());
gpr_log(GPR_INFO, "actual_error: %s", grpc_error_std_string(error).c_str());
if (state->expected_error == GRPC_ERROR_NONE) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
} else {

@ -219,7 +219,8 @@ static Json parse_json_part_from_jwt(const char* str, size_t len) {
absl::string_view string = grpc_core::StringViewFromSlice(slice);
Json json = Json::Parse(string, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parse error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parse error: %s",
grpc_error_std_string(error).c_str());
GRPC_ERROR_UNREF(error);
}
grpc_slice_unref(slice);

@ -210,7 +210,8 @@ static void test_claims_success(void) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(claims_without_time_constraint, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parse error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parse error: %s",
grpc_error_std_string(error).c_str());
}
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(json.type() == Json::Type::OBJECT);
@ -232,7 +233,8 @@ static void test_expired_claims_failure(void) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(expired_claims, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parse error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parse error: %s",
grpc_error_std_string(error).c_str());
}
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(json.type() == Json::Type::OBJECT);
@ -260,7 +262,8 @@ static void test_invalid_claims_failure(void) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(invalid_claims, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parse error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parse error: %s",
grpc_error_std_string(error).c_str());
}
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(json.type() == Json::Type::OBJECT);
@ -273,7 +276,8 @@ static void test_bad_audience_claims_failure(void) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(claims_without_time_constraint, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parse error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parse error: %s",
grpc_error_std_string(error).c_str());
}
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(json.type() == Json::Type::OBJECT);
@ -290,7 +294,8 @@ static void test_bad_subject_claims_failure(void) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(claims_with_bad_subject, &error);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "JSON parse error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "JSON parse error: %s",
grpc_error_std_string(error).c_str());
}
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(json.type() == Json::Type::OBJECT);

@ -45,7 +45,8 @@ static void on_oauth2_response(void* arg, grpc_error_handle error) {
char* token = nullptr;
grpc_slice token_slice;
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Fetching token failed: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "Fetching token failed: %s",
grpc_error_std_string(error).c_str());
} else {
GPR_ASSERT(request->md_array.size == 1);
token_slice = GRPC_MDVALUE(request->md_array.md[0]);

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

@ -106,7 +106,7 @@ class Client {
grpc_resolved_addresses* server_addresses = nullptr;
grpc_error_handle error =
grpc_blocking_resolve_address(server_address_, "80", &server_addresses);
ASSERT_EQ(GRPC_ERROR_NONE, error) << grpc_error_string(error);
ASSERT_EQ(GRPC_ERROR_NONE, error) << grpc_error_std_string(error);
ASSERT_GE(server_addresses->naddrs, 1UL);
pollset_ = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollset_, &mu_);
@ -181,7 +181,8 @@ class Client {
private:
static void OnEventDone(void* arg, grpc_error_handle error) {
gpr_log(GPR_INFO, "OnEventDone(): %s", grpc_error_string(error));
gpr_log(GPR_INFO, "OnEventDone(): %s",
grpc_error_std_string(error).c_str());
EventState* state = static_cast<EventState*>(arg);
state->error_ = GRPC_ERROR_REF(error);
gpr_atm_rel_store(&state->done_atm_, 1);

@ -136,9 +136,8 @@ static void got_port_from_server(void* arg, grpc_error_handle error) {
if (error != GRPC_ERROR_NONE) {
failed = 1;
const char* msg = grpc_error_string(error);
gpr_log(GPR_DEBUG, "failed port pick from server: retrying [%s]", msg);
gpr_log(GPR_DEBUG, "failed port pick from server: retrying [%s]",
grpc_error_std_string(error).c_str());
} else if (response->status != 200) {
failed = 1;
gpr_log(GPR_DEBUG, "failed port pick from server: status=%d",

@ -47,10 +47,10 @@ TEST(FileWatcherConfigTest, Basic) {
kIdentityCertFile, kPrivateKeyFile, kRootCertFile, kRefreshInterval);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(config->identity_cert_file(), kIdentityCertFile);
EXPECT_EQ(config->private_key_file(), kPrivateKeyFile);
EXPECT_EQ(config->root_cert_file(), kRootCertFile);
@ -67,10 +67,10 @@ TEST(FileWatcherConfigTest, DefaultRefreshInterval) {
kIdentityCertFile, kPrivateKeyFile, kRootCertFile);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(config->identity_cert_file(), kIdentityCertFile);
EXPECT_EQ(config->private_key_file(), kPrivateKeyFile);
EXPECT_EQ(config->root_cert_file(), kRootCertFile);
@ -85,10 +85,10 @@ TEST(FileWatcherConfigTest, OnlyRootCertificatesFileProvided) {
kRootCertFile);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_TRUE(config->identity_cert_file().empty());
EXPECT_TRUE(config->private_key_file().empty());
EXPECT_EQ(config->root_cert_file(), kRootCertFile);
@ -104,10 +104,10 @@ TEST(FileWatcherConfigTest, OnlyIdenityCertificatesAndPrivateKeyProvided) {
kIdentityCertFile, kPrivateKeyFile);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(config->identity_cert_file(), kIdentityCertFile);
EXPECT_EQ(config->private_key_file(), kPrivateKeyFile);
EXPECT_TRUE(config->root_cert_file().empty());
@ -124,10 +124,10 @@ TEST(FileWatcherConfigTest, WrongTypes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"field:certificate_file error:type should be STRING.*"
"field:private_key_file error:type should be STRING.*"
@ -146,10 +146,10 @@ TEST(FileWatcherConfigTest, IdentityCertProvidedButPrivateKeyMissing) {
kIdentityCertFile);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"fields \"certificate_file\" and \"private_key_file\" must "
"be both set or both unset."));
@ -164,10 +164,10 @@ TEST(FileWatcherConfigTest, PrivateKeyProvidedButIdentityCertMissing) {
kPrivateKeyFile);
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"fields \"certificate_file\" and \"private_key_file\" must "
"be both set or both unset."));
@ -178,11 +178,11 @@ TEST(FileWatcherConfigTest, EmptyJsonObject) {
std::string json_str = absl::StrFormat("{}");
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
FileWatcherCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("At least one of \"certificate_file\" and "
"\"ca_certificate_file\" must be specified."));
GRPC_ERROR_UNREF(error);

@ -69,10 +69,10 @@ TEST(GoogleMeshCaConfigTest, Basic) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(config->endpoint(), "newmeshca.googleapis.com");
EXPECT_EQ(config->sts_config().token_exchange_service_uri,
"newsecuretoken.googleapis.com");
@ -122,10 +122,10 @@ TEST(GoogleMeshCaConfigTest, Defaults) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(config->endpoint(), "meshca.googleapis.com");
EXPECT_EQ(config->sts_config().token_exchange_service_uri,
"securetoken.googleapis.com");
@ -174,11 +174,11 @@ TEST(GoogleMeshCaConfigTest, WrongExpectedValues) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("field:api_type error:Only GRPC is supported.*"
"field:key_type error:Only RSA is supported"));
GRPC_ERROR_UNREF(error);
@ -217,11 +217,11 @@ TEST(GoogleMeshCaConfigTest, WrongTypes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex(
"field:server.*field:api_type error:type should be STRING.*"
"field:grpc_services.*field:google_grpc.*field:target_uri "
@ -261,11 +261,11 @@ TEST(GoogleMeshCaConfigTest, GrpcServicesNotAnArray) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex(
"field:server.*field:grpc_services error:type should be ARRAY"));
GRPC_ERROR_UNREF(error);
@ -286,11 +286,11 @@ TEST(GoogleMeshCaConfigTest, GoogleGrpcNotAnObject) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("field:server.*field:grpc_services.*field:"
"google_grpc error:type should be OBJECT"));
GRPC_ERROR_UNREF(error);
@ -313,10 +313,10 @@ TEST(GoogleMeshCaConfigTest, CallCredentialsNotAnArray) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"field:server.*field:grpc_services.*field:google_grpc.*"
"field:call_credentials error:type should be ARRAY"));
@ -342,11 +342,11 @@ TEST(GoogleMeshCaConfigTest, StsServiceNotAnObject) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto config =
GoogleMeshCaCertificateProviderFactory::Config::Parse(json, &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex(
"field:server.*field:grpc_services.*field:google_grpc.*field:"
"call_credentials.*field:sts_service error:type should be OBJECT"));

@ -115,9 +115,9 @@ TEST_P(XdsBootstrapTest, Basic) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(bootstrap.server().server_uri, "fake:///lb");
EXPECT_EQ(bootstrap.server().channel_creds_type, "fake");
EXPECT_EQ(bootstrap.server().channel_creds_config.type(),
@ -157,9 +157,9 @@ TEST_P(XdsBootstrapTest, ValidWithoutNode) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(bootstrap.server().server_uri, "fake:///lb");
EXPECT_EQ(bootstrap.server().channel_creds_type, "fake");
EXPECT_EQ(bootstrap.node(), nullptr);
@ -177,9 +177,9 @@ TEST_P(XdsBootstrapTest, InsecureCreds) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(bootstrap.server().server_uri, "fake:///lb");
EXPECT_EQ(bootstrap.server().channel_creds_type, "insecure");
EXPECT_EQ(bootstrap.node(), nullptr);
@ -213,9 +213,9 @@ TEST_P(XdsBootstrapTest, GoogleDefaultCreds) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_EQ(bootstrap.server().server_uri, "fake:///lb");
EXPECT_EQ(bootstrap.server().channel_creds_type, "google_default");
EXPECT_EQ(bootstrap.node(), nullptr);
@ -232,9 +232,9 @@ TEST_P(XdsBootstrapTest, MissingChannelCreds) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex("\"channel_creds\" field not present"));
GRPC_ERROR_UNREF(error);
}
@ -251,9 +251,9 @@ TEST_P(XdsBootstrapTest, NoKnownChannelCreds) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"no known creds type found in \"channel_creds\""));
GRPC_ERROR_UNREF(error);
@ -262,9 +262,9 @@ TEST_P(XdsBootstrapTest, NoKnownChannelCreds) {
TEST_P(XdsBootstrapTest, MissingXdsServers) {
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse("{}", &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex("\"xds_servers\" field not present"));
GRPC_ERROR_UNREF(error);
}
@ -279,15 +279,15 @@ TEST_P(XdsBootstrapTest, TopFieldsWrongTypes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex("\"xds_servers\" field is not an array.*"
"\"node\" field is not an object.*"
"\"server_listener_resource_name_"
"template\" field is not a string.*"));
if (GetParam().parse_xds_certificate_providers()) {
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"\"certificate_providers\" field is not an object"));
}
@ -301,9 +301,9 @@ TEST_P(XdsBootstrapTest, XdsServerMissingServerUri) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex("errors parsing \"xds_servers\" array.*"
"errors parsing index 0.*"
"\"server_uri\" field not present"));
@ -322,10 +322,10 @@ TEST_P(XdsBootstrapTest, XdsServerUriAndCredsWrongTypes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("errors parsing \"xds_servers\" array.*"
"errors parsing index 0.*"
"\"server_uri\" field is not a string.*"
@ -350,10 +350,10 @@ TEST_P(XdsBootstrapTest, ChannelCredsFieldsWrongTypes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(
grpc_error_string(error),
grpc_error_std_string(error),
::testing::ContainsRegex("errors parsing \"xds_servers\" array.*"
"errors parsing index 0.*"
"errors parsing \"channel_creds\" array.*"
@ -375,9 +375,9 @@ TEST_P(XdsBootstrapTest, NodeFieldsWrongTypes) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex("errors parsing \"node\" object.*"
"\"id\" field is not a string.*"
"\"cluster\" field is not a string.*"
@ -399,9 +399,9 @@ TEST_P(XdsBootstrapTest, LocalityFieldsWrongType) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex("errors parsing \"node\" object.*"
"errors parsing \"locality\" object.*"
"\"region\" field is not a string.*"
@ -425,15 +425,15 @@ TEST_P(XdsBootstrapTest, CertificateProvidersElementWrongType) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
if (GetParam().parse_xds_certificate_providers()) {
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing \"certificate_providers\" object.*"
"element \"plugin\" is not an object"));
} else {
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
}
GRPC_ERROR_UNREF(error);
}
@ -455,16 +455,16 @@ TEST_P(XdsBootstrapTest, CertificateProvidersPluginNameWrongType) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
if (GetParam().parse_xds_certificate_providers()) {
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing \"certificate_providers\" object.*"
"errors parsing element \"plugin\".*"
"\"plugin_name\" field is not a string"));
} else {
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
}
GRPC_ERROR_UNREF(error);
}
@ -540,16 +540,16 @@ TEST_P(XdsBootstrapTest, CertificateProvidersFakePluginParsingError) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
if (GetParam().parse_xds_certificate_providers()) {
EXPECT_THAT(grpc_error_string(error),
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing \"certificate_providers\" object.*"
"errors parsing element \"fake_plugin\".*"
"field:config field:value not of type number"));
} else {
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
}
GRPC_ERROR_UNREF(error);
}
@ -576,9 +576,9 @@ TEST_P(XdsBootstrapTest, CertificateProvidersFakePluginParsingSuccess) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
ASSERT_TRUE(error == GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_TRUE(error == GRPC_ERROR_NONE) << grpc_error_std_string(error);
if (GetParam().parse_xds_certificate_providers()) {
const CertificateProviderStore::PluginDefinition& fake_plugin =
bootstrap.certificate_providers().at("fake_plugin");
@ -613,9 +613,9 @@ TEST_P(XdsBootstrapTest, CertificateProvidersFakePluginEmptyConfig) {
"}";
grpc_error_handle error = GRPC_ERROR_NONE;
Json json = Json::Parse(json_str, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
XdsBootstrap bootstrap(std::move(json), &error);
ASSERT_TRUE(error == GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_TRUE(error == GRPC_ERROR_NONE) << grpc_error_std_string(error);
if (GetParam().parse_xds_certificate_providers()) {
const CertificateProviderStore::PluginDefinition& fake_plugin =
bootstrap.certificate_providers().at("fake_plugin");

@ -149,16 +149,16 @@ TEST(
GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(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(), GRPC_ERROR_NONE);
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity certs. Test that the identity cert error is
// reset.
@ -217,16 +217,16 @@ TEST(XdsCertificateProviderTest,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(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(), GRPC_ERROR_NONE);
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity certs. Test that the identity cert error is
// reset.
@ -281,7 +281,7 @@ TEST(XdsCertificateProviderTest,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(kRootErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_EQ(watcher->identity_cert_error(), GRPC_ERROR_NONE);
distributor->SetErrorForCert(
@ -289,16 +289,16 @@ TEST(XdsCertificateProviderTest,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(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(), GRPC_ERROR_NONE);
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity
distributor->SetKeyMaterials("identity", kRootCert2, MakeKeyCertPairsType1());
@ -345,7 +345,7 @@ TEST(XdsCertificateProviderTest,
absl::nullopt);
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_EQ(watcher->identity_cert_error(), GRPC_ERROR_NONE);
// Set error for identity
@ -354,16 +354,16 @@ TEST(XdsCertificateProviderTest,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(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(), GRPC_ERROR_NONE);
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update for identity
distributor->SetKeyMaterials("", absl::nullopt, MakeKeyCertPairsType1());
@ -383,11 +383,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_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_string(watcher->identity_cert_error()),
grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Update root cert distributor.
@ -396,7 +396,7 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
EXPECT_EQ(watcher->key_cert_pairs(), absl::nullopt);
EXPECT_EQ(watcher->root_cert_error(), GRPC_ERROR_NONE);
EXPECT_THAT(
grpc_error_string(watcher->identity_cert_error()),
grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Update identity cert distributor
@ -417,9 +417,9 @@ TEST(XdsCertificateProviderTest, SwapOutDistributorsMultipleTimes) {
GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage));
EXPECT_EQ(watcher->root_certs(), kRootCert2);
EXPECT_EQ(watcher->key_cert_pairs(), MakeKeyCertPairsType2());
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(kRootErrorMessage));
EXPECT_THAT(grpc_error_string(watcher->identity_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(kIdentityErrorMessage));
// Send an update again
distributor->SetKeyMaterials("", kRootCert1, MakeKeyCertPairsType1());
@ -432,7 +432,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_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_EQ(watcher->identity_cert_error(), GRPC_ERROR_NONE);
@ -441,11 +441,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_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_string(watcher->identity_cert_error()),
grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Change certificate names being watched, without any certificate updates.
@ -453,11 +453,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_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_string(watcher->identity_cert_error()),
grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Send out certificate updates.
@ -509,11 +509,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_string(watcher1->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher1->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_string(watcher1->identity_cert_error()),
grpc_error_std_string(watcher1->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
// Add distributor for "test1". This will return data to the watcher.
@ -557,11 +557,11 @@ TEST(XdsCertificateProviderTest, UnknownCertName) {
auto* watcher = new TestCertificatesWatcher;
provider.distributor()->WatchTlsCertificates(
std::unique_ptr<TestCertificatesWatcher>(watcher), "test", "test");
EXPECT_THAT(grpc_error_string(watcher->root_cert_error()),
EXPECT_THAT(grpc_error_std_string(watcher->root_cert_error()),
::testing::HasSubstr(
"No certificate provider available for root certificates"));
EXPECT_THAT(
grpc_error_string(watcher->identity_cert_error()),
grpc_error_std_string(watcher->identity_cert_error()),
::testing::HasSubstr(
"No certificate provider available for identity certificates"));
}

@ -71,7 +71,7 @@ void TryConnectAndDestroy() {
grpc_error_handle error = GRPC_ERROR_NONE;
lb_address_result.service_config = grpc_core::ServiceConfig::Create(
nullptr, "{\"loadBalancingConfig\":[{\"grpclb\":{}}]}", &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
grpc_arg arg = grpc_core::CreateGrpclbBalancerAddressesArg(&addresses);
lb_address_result.args = grpc_channel_args_copy_and_add(nullptr, &arg, 1);
response_generator->SetResponse(lb_address_result);

@ -2046,7 +2046,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
: kDefaultServiceConfigWithoutLoadReporting;
result.service_config =
grpc_core::ServiceConfig::Create(nullptr, service_config_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_NE(result.service_config.get(), nullptr);
if (response_generator == nullptr) {
response_generator = response_generator_.get();
@ -2078,7 +2078,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
result.service_config = grpc_core::ServiceConfig::Create(
nullptr, service_config_json, &error);
ASSERT_NE(result.service_config.get(), nullptr);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
}
if (expected_targets != nullptr) {
grpc_arg expected_targets_arg = grpc_channel_arg_string_create(

@ -269,7 +269,7 @@ void CheckServiceConfigResultLocked(const char* service_config_json,
if (args->expected_service_config_error.empty()) {
EXPECT_EQ(service_config_error, GRPC_ERROR_NONE);
} else {
EXPECT_THAT(grpc_error_string(service_config_error),
EXPECT_THAT(grpc_error_std_string(service_config_error),
testing::HasSubstr(args->expected_service_config_error));
}
GRPC_ERROR_UNREF(service_config_error);
@ -436,7 +436,8 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler {
}
void ReturnError(grpc_error_handle error) override {
gpr_log(GPR_ERROR, "resolver returned error: %s", grpc_error_string(error));
gpr_log(GPR_ERROR, "resolver returned error: %s",
grpc_error_std_string(error).c_str());
GPR_ASSERT(false);
}

@ -61,7 +61,7 @@ void VaidateProtoJsonTranslation(const std::string& json_str) {
grpc_error_handle error = GRPC_ERROR_NONE;
grpc_core::Json parsed_json =
grpc_core::Json::Parse(proto_json_str.c_str(), &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_string(error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
ASSERT_EQ(parsed_json.type(), grpc_core::Json::Type::OBJECT);
proto_json_str = parsed_json.Dump();
// uncomment these to compare the json strings.

Loading…
Cancel
Save