Go to the documentation of this file.
53 #ifdef GRPC_ERROR_IS_ABSEIL_STATUS
59 for (
size_t i = 0;
i < children_count; ++
i) {
72 const char* call_name) {
85 const char* call_name) {
114 if (
value.has_value()) {
120 switch (
error.code()) {
177 if (
value.has_value()) {
183 switch (
error.code()) {
188 *
s =
"RESOURCE_EXHAUSTED";
222 #else // GRPC_ERROR_IS_ABSEIL_STATUS
233 return "grpc_status";
241 return "http2_error";
249 return "http_status";
251 return "occurred_during_write";
253 return "channel_connectivity_state";
255 return "lb_policy_drop";
269 return "description";
273 return "target_address";
279 return "grpc_message";
373 if ((*err)->arena_size + slots > (*err)->arena_capacity) {
375 size_t(
UINT8_MAX - 1),
size_t(3 * (*err)->arena_capacity / 2)));
376 if ((*err)->arena_size + slots > (*err)->arena_capacity) {
392 uint8_t placement = (*err)->arena_size;
393 (*err)->arena_size =
static_cast<uint8_t>((*err)->arena_size + slots);
408 (*err)->ints[
which] = slot;
409 (*err)->arena[slot] =
value;
426 *
reinterpret_cast<grpc_slice*
>((*err)->arena + slot));
428 (*err)->strs[
which] = slot;
446 (*err)->times[
which] = slot;
464 (*err)->last_err = slot;
465 (*err)->first_err = slot;
470 old_last->
next = slot;
471 (*err)->last_err = slot;
476 #define SLOTS_PER_INT (1) // == (sizeof(intptr_t) / sizeof(intptr_t))
477 #define SLOTS_PER_STR (sizeof(grpc_slice) / sizeof(intptr_t))
478 #define SLOTS_PER_TIME (sizeof(gpr_timespec) / sizeof(intptr_t))
479 #define SLOTS_PER_LINKED_ERROR (sizeof(grpc_linked_error) / sizeof(intptr_t))
483 #define DEFAULT_ERROR_CAPACITY \
484 (SLOTS_PER_INT + (SLOTS_PER_STR * 2) + SLOTS_PER_TIME)
487 #define SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME)
492 size_t num_referencing) {
499 if (
err ==
nullptr) {
505 "Error creation occurred when error creation was disabled [%s:%d]",
515 err->arena_capacity = initial_arena_capacity;
528 for (
size_t i = 0;
i < num_referencing; ++
i) {
582 uint8_t new_arena_capacity =
in->arena_capacity;
585 if (
in->arena_capacity -
in->arena_size <
587 new_arena_capacity =
static_cast<uint8_t>(3 * new_arena_capacity / 2);
598 size_t skip =
sizeof(&
out->atomics);
605 out->arena_capacity = new_arena_capacity;
629 strlen(
"RESOURCE_EXHAUSTED")},
632 strlen(
"CANCELLED")},
644 if (
p !=
nullptr) *
p =
err->arena[slot];
684 }
else if (
child != src) {
713 static void append_chr(
char c,
char** s,
size_t* sz,
size_t* cap) {
715 *cap =
std::max(
size_t(8), 3 * *cap / 2);
721 static void append_str(
const char*
str,
char** s,
size_t* sz,
size_t* cap) {
722 for (
const char*
c =
str; *
c;
c++) {
729 static const char* hex =
"0123456789abcdef";
731 for (
size_t i = 0;
i <
len;
i++,
str++) {
732 if (*str < 32 || *str >= 127) {
826 const char* pfx =
"!!";
827 switch (
tm.clock_type) {
885 return strcmp(ka->
key, kb->
key);
897 strlen(kvs->
kvs[
i].
key), &s, &sz, &cap);
918 return static_cast<const char*
>(
p);
922 memset(&kvs, 0,
sizeof(kvs));
949 const char* call_name) {
963 const char* call_name) {
990 #endif // GRPC_ERROR_IS_ABSEIL_STATUS
@ GRPC_ERROR_INT_WSA_ERROR
WSAGetLastError() reported when this error occurred.
@ GRPC_ERROR_STR_SYSCALL
syscall that generated this error
static char * fmt_str(const grpc_slice &slice)
#define gpr_atm_no_barrier_load(p)
#define gpr_atm_no_barrier_store(p, value)
@ GRPC_STATUS_UNAVAILABLE
const grpc_slice & grpc_slice_ref_internal(const grpc_slice &slice)
@ kRpcStatus
grpc status code representing this error
@ GRPC_ERROR_STR_FILE
source file in which this error occurred
return memset(p, 0, total)
grpc_error_handle grpc_error_create(const char *file, int line, const grpc_slice &desc, grpc_error_handle *referencing, size_t num_referencing)
Create an error - but use GRPC_ERROR_CREATE instead.
#define GPR_DEBUG_ASSERT(x)
static void internal_set_int(grpc_error_handle *err, grpc_error_ints which, intptr_t value)
void grpc_disable_error_creation()
@ GRPC_ERROR_STR_MAX
Must always be last.
@ GRPC_ERROR_INT_LB_POLICY_DROP
LB policy drop.
void StatusAddChild(absl::Status *status, absl::Status child)
Adds a child status to status.
@ GRPC_ERROR_INT_HTTP2_ERROR
http2 error code associated with the error (see the HTTP2 RFC)
@ kOsError
operating system description of this error
@ GRPC_ERROR_INT_INDEX
context sensitive index associated with the error
const special_error_status_map error_status_map[]
static grpc_error_handle copy_error_and_unref(grpc_error_handle in)
@ GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE
channel connectivity state associated with the error
absl::string_view StringViewFromSlice(const grpc_slice &slice)
GPRAPI void gpr_free(void *ptr)
static char * finish_kvs(kv_pairs *kvs)
static const char * oom_error_string
#define DEFAULT_ERROR_CAPACITY
static const char * no_error_string
GPRAPI char * gpr_format_message(int messageid)
#define gpr_atm_rel_cas(p, o, n)
GPRAPI void * gpr_malloc(size_t size)
absl::Status StatusCreate(absl::StatusCode code, absl::string_view msg, const DebugLocation &location, std::vector< absl::Status > children)
Creates a status with given additional information.
@ GRPC_ERROR_INT_FD
File descriptor associated with this error.
static void append_esc_str(const uint8_t *str, size_t len, char **s, size_t *sz, size_t *cap)
@ kSyscall
syscall that generated this error
@ GRPC_ERROR_STR_RAW_BYTES
hex dump (or similar) with the data that generated this error
static int cmp_kvs(const void *a, const void *b)
#define GRPC_ERROR_CANCELLED
@ GRPC_STATUS_INVALID_ARGUMENT
@ GRPC_STATUS_RESOURCE_EXHAUSTED
static gpr_atm g_error_creation_allowed
static char * errs_string(grpc_error_handle err)
@ GRPC_ERROR_STR_DESCRIPTION
top-level textual description of this error
absl::optional< std::string > StatusGetStr(const absl::Status &status, StatusStrProperty key)
Gets the str property from the status.
@ GRPC_ERROR_INT_TSI_CODE
TSI status code associated with the error.
grpc_error_handle grpc_error_set_str(grpc_error_handle src, grpc_error_strs which, absl::string_view str)
@ GRPC_ERROR_STR_TARGET_ADDRESS
peer that we were trying to communicate when this error occurred
grpc_core::DebugOnlyTraceFlag grpc_trace_closure(false, "closure")
static void collect_ints_kvs(grpc_error_handle err, kv_pairs *kvs)
grpc_error_handle grpc_error_add_child(grpc_error_handle src, grpc_error_handle child)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void StatusSetInt(absl::Status *status, StatusIntProperty key, intptr_t value)
Sets the int property to the status.
grpc_error_handle grpc_error_do_ref(grpc_error_handle err, const char *file, int line)
@ GRPC_ERROR_TIME_CREATED
timestamp of error creation
static char * key_int(grpc_error_ints which)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
static void collect_times_kvs(grpc_error_handle err, kv_pairs *kvs)
GPRAPI void * gpr_realloc(void *p, size_t size)
grpc_error_handle grpc_wsa_error(const char *file, int line, int err, const char *call_name) GRPC_MUST_USE_RESULT
def c_str(s, encoding='ascii')
std::string StatusToString(const absl::Status &status)
bool grpc_log_error(const char *what, grpc_error_handle error, const char *file, int line)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
static void internal_add_error(grpc_error_handle *err, grpc_error_handle new_err)
Status UnknownError(absl::string_view message)
#define gpr_atm_acq_load(p)
@ GRPC_ERROR_INT_SIZE
context sensitive size associated with the error
@ GRPC_ERROR_INT_STREAM_ID
#define GRPC_SLICE_START_PTR(slice)
static void append_str(const char *str, char **s, size_t *sz, size_t *cap)
@ kWsaError
WSAGetLastError() reported when this error occurred.
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
bool grpc_error_get_int(grpc_error_handle err, grpc_error_ints which, intptr_t *p)
@ GRPC_ERROR_STR_GRPC_MESSAGE
grpc status message associated with this error
GPRAPI int gpr_asprintf(char **strp, const char *format,...) GPR_PRINT_FORMAT_CHECK(2
void StatusSetStr(absl::Status *status, StatusStrProperty key, absl::string_view value)
Sets the str property to the status.
static char * fmt_int(intptr_t p)
static void unref_errs(grpc_error_handle err)
static uint8_t get_placement(grpc_error_handle *err, size_t size)
_W64 unsigned int uintptr_t
@ GRPC_ERROR_INT_MAX
Must always be last.
static const char * error_time_name(grpc_error_times key)
void qsort(void *a, size_t n, size_t es, int(*cmp)(const void *, const void *))
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
static void ref_errs(grpc_error_handle err)
static void internal_set_time(grpc_error_handle *err, grpc_error_times which, gpr_timespec value)
static char * key_str(grpc_error_strs which)
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
static void append_kv(kv_pairs *kvs, char *key, char *value)
#define GRPC_SLICE_LENGTH(slice)
@ GRPC_ERROR_STR_FILENAME
filename that we were trying to read/write when this error occurred
@ GRPC_ERROR_STR_OS_ERROR
operating system description of this error
ABSL_NAMESPACE_BEGIN class ABSL_MUST_USE_RESULT Status
GPRAPI char * grpc_slice_to_c_string(grpc_slice s)
grpc_error_handle grpc_os_error(const char *file, int line, int err, const char *call_name)
static void unref_strs(grpc_error_handle err)
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
#define GRPC_ERROR_REF(err)
#define SLOTS_PER_LINKED_ERROR
grpc_error_handle grpc_error_set_int(grpc_error_handle src, grpc_error_ints which, intptr_t value)
static void append_chr(char c, char **s, size_t *sz, size_t *cap)
std::string grpc_error_std_string(grpc_error_handle error)
@ GRPC_ERROR_TIME_MAX
Must always be last.
static void ref_strs(grpc_error_handle err)
static const char * error_str_name(grpc_error_strs key)
@ GRPC_ERROR_INT_ERRNO
'errno' from the operating system
static void internal_set_str(grpc_error_handle *err, grpc_error_strs which, const grpc_slice &value)
@ GRPC_ERROR_STR_TSI_ERROR
tsi error string associated with this error
static const char * cancelled_error_string
grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount(false, "error_refcount")
const char * grpc_error_string(grpc_error_handle err)
@ GRPC_ERROR_STR_VALUE
value associated with the error
@ GRPC_ERROR_STR_KEY
key associated with the error
#define GRPC_ERROR_UNREF(err)
bool grpc_error_is_special(grpc_error_handle err)
@ GRPC_ERROR_INT_FILE_LINE
LINE from the call site creating the error
StatusStrProperty
This enum should have the same value of grpc_error_strs.
GPRAPI char * gpr_strdup(const char *src)
void grpc_error_do_unref(grpc_error_handle err, const char *file, int line)
static void add_errs(grpc_error_handle err, char **s, size_t *sz, size_t *cap)
absl::optional< intptr_t > StatusGetInt(const absl::Status &status, StatusIntProperty key)
Gets the int property from the status.
static void error_destroy(grpc_error_handle err)
GPRAPI void gpr_ref_init(gpr_refcount *r, int n)
@ GRPC_ERROR_INT_OCCURRED_DURING_WRITE
chttp2: did the error occur while a write was in progress
bool grpc_error_get_str(grpc_error_handle err, grpc_error_strs which, std::string *s)
Returns false if the specified string is not set.
@ GRPC_ERROR_INT_HTTP_STATUS
HTTP status (i.e. 404)
GPRAPI int gpr_unref(gpr_refcount *r)
static char * key_time(grpc_error_times which)
StatusIntProperty
This enum should have the same value of grpc_error_ints.
std::map< std::string, Node * > children
static const char * error_int_name(grpc_error_ints key)
GPRAPI void gpr_ref(gpr_refcount *r)
GPRAPI int gpr_ref_is_unique(gpr_refcount *r)
@ GRPC_ERROR_INT_GRPC_STATUS
grpc status code representing this error
void grpc_slice_unref_internal(const grpc_slice &slice)
static void collect_strs_kvs(grpc_error_handle err, kv_pairs *kvs)
@ kErrorNo
'errno' from the operating system
#define GRPC_ERROR_IS_NONE(err)
void grpc_enable_error_creation()
static char * fmt_time(gpr_timespec tm)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:15