19 #ifndef GRPC_CORE_LIB_IOMGR_ERROR_H
20 #define GRPC_CORE_LIB_IOMGR_ERROR_H
125 #define GRPC_ERROR_NONE ((grpc_error*)NULL)
126 #define GRPC_ERROR_RESERVED_1 ((grpc_error*)1)
127 #define GRPC_ERROR_OOM ((grpc_error*)2)
128 #define GRPC_ERROR_RESERVED_2 ((grpc_error*)3)
129 #define GRPC_ERROR_CANCELLED ((grpc_error*)4)
130 #define GRPC_ERROR_SPECIAL_MAX GRPC_ERROR_CANCELLED
146 size_t num_referencing);
155 #define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc) \
156 grpc_error_create(__FILE__, __LINE__, grpc_slice_from_static_string(desc), \
158 #define GRPC_ERROR_CREATE_FROM_COPIED_STRING(desc) \
159 grpc_error_create(__FILE__, __LINE__, grpc_slice_from_copied_string(desc), \
164 #define GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(desc, errs, count) \
165 grpc_error_create(__FILE__, __LINE__, grpc_slice_from_static_string(desc), \
167 #define GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(desc, errs, count) \
168 grpc_error_create(__FILE__, __LINE__, grpc_slice_from_copied_string(desc), \
171 #define GRPC_ERROR_CREATE_FROM_VECTOR(desc, error_list) \
172 grpc_error_create_from_vector(__FILE__, __LINE__, desc, error_list)
185 #define GRPC_ERROR_REF(err) grpc_error_ref(err, __FILE__, __LINE__)
186 #define GRPC_ERROR_UNREF(err) grpc_error_unref(err, __FILE__, __LINE__)
198 #define GRPC_ERROR_REF(err) grpc_error_ref(err)
199 #define GRPC_ERROR_UNREF(err) grpc_error_unref(err)
205 static grpc_error* grpc_error_create_from_vector(
206 const char* file,
int line,
const char* desc,
209 if (error_list->
size() != 0) {
211 error_list->
data(), error_list->
size());
213 for (
size_t i = 0; i < error_list->
size(); i++) {
258 #define GRPC_OS_ERROR(err, call_name) \
259 grpc_assert_never_ok(grpc_os_error(__FILE__, __LINE__, err, call_name))
263 #define GRPC_WSA_ERROR(err, call_name) \
264 grpc_wsa_error(__FILE__, __LINE__, err, call_name)
269 const char* file,
int line) {
274 #define GRPC_LOG_IF_ERROR(what, error) \
275 (grpc_log_if_error((what), (error), __FILE__, __LINE__))
Definition: inlined_vector.h:60
T * data()
Definition: inlined_vector.h:93
size_t size() const
Definition: inlined_vector.h:165
void clear()
Definition: inlined_vector.h:170
bool grpc_log_error(const char *what, grpc_error *error, const char *file, int line)
grpc_error_times
Definition: error.h:113
@ GRPC_ERROR_TIME_MAX
Must always be last.
Definition: error.h:118
@ GRPC_ERROR_TIME_CREATED
timestamp of error creation
Definition: error.h:115
grpc_error * grpc_error_set_int(grpc_error *src, grpc_error_ints which, intptr_t value) GRPC_MUST_USE_RESULT
grpc_error * grpc_error_set_str(grpc_error *src, grpc_error_strs which, const grpc_slice &str) GRPC_MUST_USE_RESULT
This call takes ownership of the slice; the error is responsible for eventually unref-ing it.
grpc_error_ints
Definition: error.h:43
@ GRPC_ERROR_INT_HTTP_STATUS
HTTP status (i.e. 404)
Definition: error.h:71
@ GRPC_ERROR_INT_INDEX
context sensitive index associated with the error
Definition: error.h:57
@ GRPC_ERROR_INT_FD
File descriptor associated with this error.
Definition: error.h:69
@ GRPC_ERROR_INT_STREAM_ID
stream identifier: for errors that are associated with an individual wire stream
Definition: error.h:50
@ GRPC_ERROR_INT_HTTP2_ERROR
http2 error code associated with the error (see the HTTP2 RFC)
Definition: error.h:61
@ GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE
channel connectivity state associated with the error
Definition: error.h:77
@ GRPC_ERROR_INT_WSA_ERROR
WSAGetLastError() reported when this error occurred.
Definition: error.h:67
@ GRPC_ERROR_INT_MAX
Must always be last.
Definition: error.h:80
@ GRPC_ERROR_INT_GRPC_STATUS
grpc status code representing this error
Definition: error.h:52
@ GRPC_ERROR_INT_FILE_LINE
LINE from the call site creating the error
Definition: error.h:47
@ GRPC_ERROR_INT_LIMIT
context sensitive limit associated with the error
Definition: error.h:73
@ GRPC_ERROR_INT_TSI_CODE
TSI status code associated with the error.
Definition: error.h:63
@ GRPC_ERROR_INT_SECURITY_STATUS
grpc_security_status associated with the error
Definition: error.h:65
@ GRPC_ERROR_INT_SIZE
context sensitive size associated with the error
Definition: error.h:59
@ GRPC_ERROR_INT_OFFSET
offset into some binary blob (usually represented by GRPC_ERROR_STR_RAW_BYTES) where the error occurr...
Definition: error.h:55
@ GRPC_ERROR_INT_OCCURRED_DURING_WRITE
chttp2: did the error occur while a write was in progress
Definition: error.h:75
@ GRPC_ERROR_INT_ERRNO
'errno' from the operating system
Definition: error.h:45
void grpc_error_do_unref(grpc_error *err, const char *file, int line)
grpc_error * grpc_error_add_child(grpc_error *src, grpc_error *child) GRPC_MUST_USE_RESULT
Add a child error: an error that is believed to have contributed to this error occurring.
grpc_error * grpc_os_error(const char *file, int line, int err, const char *call_name) GRPC_MUST_USE_RESULT
#define GRPC_ERROR_NONE
The following "special" errors can be propagated without allocating memory.
Definition: error.h:125
const char * grpc_error_string(grpc_error *error)
bool grpc_error_is_special(struct grpc_error *err)
Definition: error.h:132
grpc_error * grpc_assert_never_ok(grpc_error *error)
Definition: error.h:252
grpc_error * grpc_error_do_ref(grpc_error *err, const char *file, int line)
grpc_error * grpc_error_create(const char *file, int line, const grpc_slice &desc, grpc_error **referencing, size_t num_referencing)
Create an error - but use GRPC_ERROR_CREATE instead.
void grpc_enable_error_creation()
bool grpc_error_get_int(grpc_error *error, grpc_error_ints which, intptr_t *p)
It is an error to pass nullptr as p.
grpc_error_strs
Definition: error.h:83
@ GRPC_ERROR_STR_TSI_ERROR
tsi error string associated with this error
Definition: error.h:99
@ GRPC_ERROR_STR_DESCRIPTION
top-level textual description of this error
Definition: error.h:85
@ GRPC_ERROR_STR_RAW_BYTES
hex dump (or similar) with the data that generated this error
Definition: error.h:97
@ GRPC_ERROR_STR_TARGET_ADDRESS
peer that we were trying to communicate when this error occurred
Definition: error.h:93
@ GRPC_ERROR_STR_GRPC_MESSAGE
grpc status message associated with this error
Definition: error.h:95
@ GRPC_ERROR_STR_OS_ERROR
operating system description of this error
Definition: error.h:89
@ GRPC_ERROR_STR_FILENAME
filename that we were trying to read/write when this error occurred
Definition: error.h:101
@ GRPC_ERROR_STR_MAX
Must always be last.
Definition: error.h:110
@ GRPC_ERROR_STR_FILE
source file in which this error occurred
Definition: error.h:87
@ GRPC_ERROR_STR_KEY
key associated with the error
Definition: error.h:105
@ GRPC_ERROR_STR_SYSCALL
syscall that generated this error
Definition: error.h:91
@ GRPC_ERROR_STR_VALUE
value associated with the error
Definition: error.h:107
@ GRPC_ERROR_STR_QUEUED_BUFFERS
which data was queued for writing when the error occurred
Definition: error.h:103
bool grpc_error_get_str(grpc_error *error, grpc_error_strs which, grpc_slice *s)
Returns false if the specified string is not set.
#define GRPC_ERROR_UNREF(err)
Definition: error.h:186
grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount
void grpc_error_unref(grpc_error *err, const char *file, int line)
Definition: error.h:181
bool grpc_log_if_error(const char *what, grpc_error *error, const char *file, int line)
Definition: error.h:268
#define GRPC_ERROR_SPECIAL_MAX
Definition: error.h:130
void grpc_disable_error_creation()
grpc_error * grpc_wsa_error(const char *file, int line, int err, const char *call_name) GRPC_MUST_USE_RESULT
grpc_error * grpc_error_ref(grpc_error *err, const char *file, int line)
Definition: error.h:177
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
Create a slice pointing to constant memory.
#define GPR_ASSERT(x)
abort() the process if x is zero, having written a line to the log.
Definition: log.h:94
Definition: error_internal.h:39
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1].
Definition: slice.h:60