GRPC Core
18.0.0
|
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/error.h"
#include <inttypes.h>
#include <string.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/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/error_internal.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
Data Structures | |
struct | special_error_status_map |
struct | kv_pair |
struct | kv_pairs |
Macros | |
#define | SLOTS_PER_INT (1) |
#define | SLOTS_PER_STR (sizeof(grpc_slice) / sizeof(intptr_t)) |
#define | SLOTS_PER_TIME (sizeof(gpr_timespec) / sizeof(intptr_t)) |
#define | SLOTS_PER_LINKED_ERROR (sizeof(grpc_linked_error) / sizeof(intptr_t)) |
#define | DEFAULT_ERROR_CAPACITY (SLOTS_PER_INT + (SLOTS_PER_STR * 2) + SLOTS_PER_TIME) |
#define | SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME) |
Functions | |
void | grpc_disable_error_creation () |
void | grpc_enable_error_creation () |
grpc_error_handle | grpc_error_do_ref (grpc_error_handle err, const char *file, int line) |
void | grpc_error_do_unref (grpc_error_handle err, const char *file, int line) |
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. More... | |
grpc_error_handle | grpc_error_set_int (grpc_error_handle src, grpc_error_ints which, intptr_t value) |
bool | grpc_error_get_int (grpc_error_handle err, grpc_error_ints which, intptr_t *p) |
It is an error to pass nullptr as p . More... | |
grpc_error_handle | grpc_error_set_str (grpc_error_handle src, grpc_error_strs which, const grpc_slice &str) |
This call takes ownership of the slice; the error is responsible for eventually unref-ing it. More... | |
bool | grpc_error_get_str (grpc_error_handle err, grpc_error_strs which, grpc_slice *str) |
Returns false if the specified string is not set. More... | |
grpc_error_handle | grpc_error_add_child (grpc_error_handle src, grpc_error_handle child) |
Add a child error: an error that is believed to have contributed to this error occurring. More... | |
const char * | grpc_error_string (grpc_error_handle err) |
std::string | grpc_error_std_string (grpc_error_handle error) |
grpc_error_handle | grpc_os_error (const char *file, int line, int err, const char *call_name) |
bool | grpc_log_error (const char *what, grpc_error_handle error, const char *file, int line) |
Variables | |
grpc_core::DebugOnlyTraceFlag | grpc_trace_error_refcount (false, "error_refcount") |
grpc_core::DebugOnlyTraceFlag | grpc_trace_closure (false, "closure") |
const special_error_status_map | error_status_map [] |
#define DEFAULT_ERROR_CAPACITY (SLOTS_PER_INT + (SLOTS_PER_STR * 2) + SLOTS_PER_TIME) |
#define SLOTS_PER_INT (1) |
#define SLOTS_PER_LINKED_ERROR (sizeof(grpc_linked_error) / sizeof(intptr_t)) |
#define SLOTS_PER_STR (sizeof(grpc_slice) / sizeof(intptr_t)) |
#define SLOTS_PER_TIME (sizeof(gpr_timespec) / sizeof(intptr_t)) |
#define SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME) |
void grpc_disable_error_creation | ( | ) |
void grpc_enable_error_creation | ( | ) |
grpc_error_handle grpc_error_add_child | ( | grpc_error_handle | src, |
grpc_error_handle | child | ||
) |
Add a child error: an error that is believed to have contributed to this error occurring.
Allows root causing high level errors from lower level errors that contributed to them. The src error takes ownership of the child error.
Edge Conditions - 1) If either of src or child is GRPC_ERROR_NONE, returns a reference to the other argument. 2) If both src and child are GRPC_ERROR_NONE, returns GRPC_ERROR_NONE. 3) If src and child point to the same error, returns a single reference. (Note that, 2 references should have been received to the error in this case.)
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.
grpc_error_handle grpc_error_do_ref | ( | grpc_error_handle | err, |
const char * | file, | ||
int | line | ||
) |
void grpc_error_do_unref | ( | grpc_error_handle | err, |
const char * | file, | ||
int | line | ||
) |
bool grpc_error_get_int | ( | grpc_error_handle | error, |
grpc_error_ints | which, | ||
intptr_t * | p | ||
) |
It is an error to pass nullptr as p
.
Caller should allocate a phony intptr_t for p
, even if the value of p
is not used.
bool grpc_error_get_str | ( | grpc_error_handle | error, |
grpc_error_strs | which, | ||
grpc_slice * | s | ||
) |
Returns false if the specified string is not set.
Caller does NOT own the slice.
grpc_error_handle grpc_error_set_int | ( | grpc_error_handle | src, |
grpc_error_ints | which, | ||
intptr_t | value | ||
) |
grpc_error_handle grpc_error_set_str | ( | grpc_error_handle | src, |
grpc_error_strs | which, | ||
const grpc_slice & | str | ||
) |
This call takes ownership of the slice; the error is responsible for eventually unref-ing it.
std::string grpc_error_std_string | ( | grpc_error_handle | error | ) |
const char* grpc_error_string | ( | grpc_error_handle | err | ) |
bool grpc_log_error | ( | const char * | what, |
grpc_error_handle | error, | ||
const char * | file, | ||
int | line | ||
) |
grpc_error_handle grpc_os_error | ( | const char * | file, |
int | line, | ||
int | err, | ||
const char * | call_name | ||
) |
const special_error_status_map error_status_map[] |
grpc_core::DebugOnlyTraceFlag grpc_trace_closure(false, "closure") | ( | false | , |
"closure" | |||
) |
grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount(false, "error_refcount") | ( | false | , |
"error_refcount" | |||
) |