#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/error.h"
#include <inttypes.h>
#include <string.h>
#include "absl/strings/str_format.h"
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gprpp/crash.h"
#ifdef GPR_WINDOWS
#include <grpc/support/log_windows.h>
#endif
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/strerror.h"
#include "src/core/lib/slice/slice_internal.h"
grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount(false,
"error_refcount");
grpc_core::DebugOnlyTraceFlag grpc_trace_closure(false, "closure");
absl::Status grpc_status_create(absl::StatusCode code, absl::string_view msg,
const grpc_core::DebugLocation& location,
size_t children_count, absl::Status* children) { … }
absl::Status grpc_os_error(const grpc_core::DebugLocation& location, int err,
const char* call_name) { … }
#ifdef GPR_WINDOWS
absl::Status grpc_wsa_error(const grpc_core::DebugLocation& location, int err,
absl::string_view call_name) {
char* utf8_message = gpr_format_message(err);
absl::Status s =
StatusCreate(absl::StatusCode::kUnavailable, "WSA Error", location, {});
StatusSetInt(&s, grpc_core::StatusIntProperty::kWsaError, err);
StatusSetInt(&s, grpc_core::StatusIntProperty::kRpcStatus,
GRPC_STATUS_UNAVAILABLE);
StatusSetStr(&s, grpc_core::StatusStrProperty::kOsError, utf8_message);
StatusSetStr(&s, grpc_core::StatusStrProperty::kSyscall, call_name);
gpr_free(utf8_message);
return s;
}
#endif
grpc_error_handle grpc_error_set_int(grpc_error_handle src,
grpc_core::StatusIntProperty which,
intptr_t value) { … }
bool grpc_error_get_int(grpc_error_handle error,
grpc_core::StatusIntProperty which, intptr_t* p) { … }
grpc_error_handle grpc_error_set_str(grpc_error_handle src,
grpc_core::StatusStrProperty which,
absl::string_view str) { … }
bool grpc_error_get_str(grpc_error_handle error,
grpc_core::StatusStrProperty which, std::string* s) { … }
grpc_error_handle grpc_error_add_child(grpc_error_handle src,
grpc_error_handle child) { … }
bool grpc_log_error(const char* what, grpc_error_handle error, const char* file,
int line) { … }