error.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2016 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
19 
21 
22 #include <inttypes.h>
23 #include <string.h>
24 
26 #include <grpc/support/alloc.h>
27 #include <grpc/support/log.h>
29 
30 #ifdef GPR_WINDOWS
32 #endif
33 
38 
40  "error_refcount");
42 
44 
47 }
48 
51 }
52 
53 #ifdef GRPC_ERROR_IS_ABSEIL_STATUS
54 
56  const grpc_core::DebugLocation& location,
57  size_t children_count, absl::Status* children) {
58  absl::Status s = StatusCreate(code, msg, location, {});
59  for (size_t i = 0; i < children_count; ++i) {
60  if (!children[i].ok()) {
62  }
63  }
64  return s;
65 }
66 
69 }
70 
72  const char* call_name) {
73  absl::Status s =
74  StatusCreate(absl::StatusCode::kUnknown, strerror(err), location, {});
77  strerror(err));
79  call_name);
80  return s;
81 }
82 
83 #ifdef GPR_WINDOWS
85  const char* call_name) {
86  char* utf8_message = gpr_format_message(err);
87  absl::Status s =
88  StatusCreate(absl::StatusCode::kUnavailable, "WSA Error", location, {});
94  return s;
95 }
96 #endif
97 
100  if (GRPC_ERROR_IS_NONE(src)) {
101  src = absl::UnknownError("");
104  }
106  &src, static_cast<grpc_core::StatusIntProperty>(which), value);
107  return src;
108 }
109 
111  intptr_t* p) {
113  error, static_cast<grpc_core::StatusIntProperty>(which));
114  if (value.has_value()) {
115  *p = *value;
116  return true;
117  } else {
118  // TODO(veblush): Remove this once absl::Status migration is done
120  switch (error.code()) {
122  *p = GRPC_STATUS_OK;
123  return true;
126  return true;
129  return true;
130  default:
131  break;
132  }
133  }
134  return false;
135  }
136 }
137 
141  if (GRPC_ERROR_IS_NONE(src)) {
142  src = absl::UnknownError("");
145  }
147  // To change the message of absl::Status, a new instance should be created
148  // with a code and payload because it doesn't have a setter for it.
149  absl::Status s = absl::Status(src.code(), str);
150  src.ForEachPayload(
152  s.SetPayload(type_url, payload);
153  });
154  return s;
155  } else {
157  &src, static_cast<grpc_core::StatusStrProperty>(which), str);
158  }
159  return src;
160 }
161 
163  std::string* s) {
165  // absl::Status uses the message field for GRPC_ERROR_STR_DESCRIPTION
166  // instead of using payload.
167  absl::string_view msg = error.message();
168  if (msg.empty()) {
169  return false;
170  } else {
171  *s = std::string(msg);
172  return true;
173  }
174  } else {
176  error, static_cast<grpc_core::StatusStrProperty>(which));
177  if (value.has_value()) {
178  *s = std::move(*value);
179  return true;
180  } else {
181  // TODO(veblush): Remove this once absl::Status migration is done
183  switch (error.code()) {
185  *s = "";
186  return true;
188  *s = "RESOURCE_EXHAUSTED";
189  return true;
191  *s = "CANCELLED";
192  return true;
193  default:
194  break;
195  }
196  }
197  return false;
198  }
199  }
200 }
201 
204  if (src.ok()) {
205  return child;
206  } else {
207  if (!child.ok()) {
209  }
210  return src;
211  }
212 }
213 
214 bool grpc_log_error(const char* what, grpc_error_handle error, const char* file,
215  int line) {
217  gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "%s: %s", what,
219  return false;
220 }
221 
222 #else // GRPC_ERROR_IS_ABSEIL_STATUS
223 
224 static const char* error_int_name(grpc_error_ints key) {
225  switch (key) {
227  return "errno";
229  return "file_line";
231  return "stream_id";
233  return "grpc_status";
235  return "offset";
237  return "index";
238  case GRPC_ERROR_INT_SIZE:
239  return "size";
241  return "http2_error";
243  return "tsi_code";
244  case GRPC_ERROR_INT_FD:
245  return "fd";
247  return "wsa_error";
249  return "http_status";
251  return "occurred_during_write";
253  return "channel_connectivity_state";
255  return "lb_policy_drop";
256  case GRPC_ERROR_INT_MAX:
257  GPR_UNREACHABLE_CODE(return "unknown");
258  }
259  GPR_UNREACHABLE_CODE(return "unknown");
260 }
261 
262 static const char* error_str_name(grpc_error_strs key) {
263  switch (key) {
264  case GRPC_ERROR_STR_KEY:
265  return "key";
267  return "value";
269  return "description";
271  return "os_error";
273  return "target_address";
275  return "syscall";
276  case GRPC_ERROR_STR_FILE:
277  return "file";
279  return "grpc_message";
281  return "raw_bytes";
283  return "tsi_error";
285  return "filename";
286  case GRPC_ERROR_STR_MAX:
287  GPR_UNREACHABLE_CODE(return "unknown");
288  }
289  GPR_UNREACHABLE_CODE(return "unknown");
290 }
291 
292 static const char* error_time_name(grpc_error_times key) {
293  switch (key) {
295  return "created";
296  case GRPC_ERROR_TIME_MAX:
297  GPR_UNREACHABLE_CODE(return "unknown");
298  }
299  GPR_UNREACHABLE_CODE(return "unknown");
300 }
301 
302 #ifndef NDEBUG
304  int line) {
306  gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err,
307  gpr_atm_no_barrier_load(&err->atomics.refs.count),
308  gpr_atm_no_barrier_load(&err->atomics.refs.count) + 1, file, line);
309  }
310  gpr_ref(&err->atomics.refs);
311  return err;
312 }
313 #else
315  gpr_ref(&err->atomics.refs);
316  return err;
317 }
318 #endif
319 
321  uint8_t slot = err->first_err;
322  while (slot != UINT8_MAX) {
323  grpc_linked_error* lerr =
324  reinterpret_cast<grpc_linked_error*>(err->arena + slot);
325  GRPC_ERROR_UNREF(lerr->err);
326  GPR_ASSERT(err->last_err == slot ? lerr->next == UINT8_MAX
327  : lerr->next != UINT8_MAX);
328  slot = lerr->next;
329  }
330 }
331 
333  for (size_t which = 0; which < GRPC_ERROR_STR_MAX; ++which) {
334  uint8_t slot = err->strs[which];
335  if (slot != UINT8_MAX) {
337  *reinterpret_cast<grpc_slice*>(err->arena + slot));
338  }
339  }
340 }
341 
344  unref_errs(err);
345  unref_strs(err);
346  gpr_free(
347  reinterpret_cast<void*>(gpr_atm_acq_load(&err->atomics.error_string)));
348  gpr_free(err);
349 }
350 
351 #ifndef NDEBUG
354  gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err,
355  gpr_atm_no_barrier_load(&err->atomics.refs.count),
356  gpr_atm_no_barrier_load(&err->atomics.refs.count) - 1, file, line);
357  }
358  if (gpr_unref(&err->atomics.refs)) {
360  }
361 }
362 #else
364  if (gpr_unref(&err->atomics.refs)) {
366  }
367 }
368 #endif
369 
371  GPR_ASSERT(*err);
372  uint8_t slots = static_cast<uint8_t>(size / sizeof(intptr_t));
373  if ((*err)->arena_size + slots > (*err)->arena_capacity) {
374  (*err)->arena_capacity = static_cast<uint8_t>(std::min(
375  size_t(UINT8_MAX - 1), size_t(3 * (*err)->arena_capacity / 2)));
376  if ((*err)->arena_size + slots > (*err)->arena_capacity) {
377  return UINT8_MAX;
378  }
379 #ifndef NDEBUG
380  grpc_error_handle orig = *err;
381 #endif
382  *err = static_cast<grpc_error_handle>(gpr_realloc(
383  *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)));
384 #ifndef NDEBUG
386  if (*err != orig) {
387  gpr_log(GPR_DEBUG, "realloc %p -> %p", orig, *err);
388  }
389  }
390 #endif
391  }
392  uint8_t placement = (*err)->arena_size;
393  (*err)->arena_size = static_cast<uint8_t>((*err)->arena_size + slots);
394  return placement;
395 }
396 
398  intptr_t value) {
399  uint8_t slot = (*err)->ints[which];
400  if (slot == UINT8_MAX) {
401  slot = get_placement(err, sizeof(value));
402  if (slot == UINT8_MAX) {
403  gpr_log(GPR_ERROR, "Error %p is full, dropping int {\"%s\":%" PRIiPTR "}",
405  return;
406  }
407  }
408  (*err)->ints[which] = slot;
409  (*err)->arena[slot] = value;
410 }
411 
413  const grpc_slice& value) {
414  uint8_t slot = (*err)->strs[which];
415  if (slot == UINT8_MAX) {
416  slot = get_placement(err, sizeof(value));
417  if (slot == UINT8_MAX) {
419  gpr_log(GPR_ERROR, "Error %p is full, dropping string {\"%s\":\"%s\"}",
421  gpr_free(str);
422  return;
423  }
424  } else {
426  *reinterpret_cast<grpc_slice*>((*err)->arena + slot));
427  }
428  (*err)->strs[which] = slot;
429  memcpy((*err)->arena + slot, &value, sizeof(value));
430 }
431 
432 static char* fmt_time(gpr_timespec tm);
435  uint8_t slot = (*err)->times[which];
436  if (slot == UINT8_MAX) {
437  slot = get_placement(err, sizeof(value));
438  if (slot == UINT8_MAX) {
439  char* time_str = fmt_time(value);
440  gpr_log(GPR_ERROR, "Error %p is full, dropping \"%s\":\"%s\"}", *err,
441  error_time_name(which), time_str);
442  gpr_free(time_str);
443  return;
444  }
445  }
446  (*err)->times[which] = slot;
447  memcpy((*err)->arena + slot, &value, sizeof(value));
448 }
449 
451 
453  grpc_error_handle new_err) {
454  grpc_linked_error new_last = {new_err, UINT8_MAX};
455  uint8_t slot = get_placement(err, sizeof(grpc_linked_error));
456  if (slot == UINT8_MAX) {
457  gpr_log(GPR_ERROR, "Error %p is full, dropping error %p = %s", *err,
458  new_err, grpc_error_string(new_err));
459  GRPC_ERROR_UNREF(new_err);
460  return;
461  }
462  if ((*err)->first_err == UINT8_MAX) {
463  GPR_ASSERT((*err)->last_err == UINT8_MAX);
464  (*err)->last_err = slot;
465  (*err)->first_err = slot;
466  } else {
467  GPR_ASSERT((*err)->last_err != UINT8_MAX);
468  grpc_linked_error* old_last =
469  reinterpret_cast<grpc_linked_error*>((*err)->arena + (*err)->last_err);
470  old_last->next = slot;
471  (*err)->last_err = slot;
472  }
473  memcpy((*err)->arena + slot, &new_last, sizeof(grpc_linked_error));
474 }
475 
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))
480 
481 // size of storing one int and two slices and a timespec. For line, desc, file,
482 // and time created
483 #define DEFAULT_ERROR_CAPACITY \
484  (SLOTS_PER_INT + (SLOTS_PER_STR * 2) + SLOTS_PER_TIME)
485 
486 // It is very common to include and extra int and string in an error
487 #define SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME)
488 
490  const grpc_slice& desc,
491  grpc_error_handle* referencing,
492  size_t num_referencing) {
493  uint8_t initial_arena_capacity = static_cast<uint8_t>(
495  static_cast<uint8_t>(num_referencing * SLOTS_PER_LINKED_ERROR) +
497  grpc_error_handle err = static_cast<grpc_error_handle>(
498  gpr_malloc(sizeof(*err) + initial_arena_capacity * sizeof(intptr_t)));
499  if (err == nullptr) { // TODO(ctiller): make gpr_malloc return NULL
500  return GRPC_ERROR_OOM;
501  }
502 #ifndef NDEBUG
505  "Error creation occurred when error creation was disabled [%s:%d]",
506  file, line);
507  abort();
508  }
510  gpr_log(GPR_DEBUG, "%p create [%s:%d]", err, file, line);
511  }
512 #endif
513 
514  err->arena_size = 0;
515  err->arena_capacity = initial_arena_capacity;
516  err->first_err = UINT8_MAX;
517  err->last_err = UINT8_MAX;
518 
522 
527 
528  for (size_t i = 0; i < num_referencing; ++i) {
529  if (referencing[i] == GRPC_ERROR_NONE) continue;
531  &err,
533  referencing[i])); // TODO(ncteisen), change ownership semantics
534  }
535 
537 
538  gpr_atm_no_barrier_store(&err->atomics.error_string, 0);
539  gpr_ref_init(&err->atomics.refs, 1);
540  return err;
541 }
542 
544  for (size_t i = 0; i < GRPC_ERROR_STR_MAX; ++i) {
545  uint8_t slot = err->strs[i];
546  if (slot != UINT8_MAX) {
548  *reinterpret_cast<grpc_slice*>(err->arena + slot));
549  }
550  }
551 }
552 
554  uint8_t slot = err->first_err;
555  while (slot != UINT8_MAX) {
556  grpc_linked_error* lerr =
557  reinterpret_cast<grpc_linked_error*>(err->arena + slot);
558  (void)GRPC_ERROR_REF(lerr->err);
559  slot = lerr->next;
560  }
561 }
562 
565  if (grpc_error_is_special(in)) {
567  if (GRPC_ERROR_IS_NONE(in)) {
569  grpc_slice_from_static_string("no error"));
571  } else if (in == GRPC_ERROR_OOM) {
574  } else if (in == GRPC_ERROR_CANCELLED) {
576  grpc_slice_from_static_string("cancelled"));
578  }
579  } else if (gpr_ref_is_unique(&in->atomics.refs)) {
580  out = in;
581  } else {
582  uint8_t new_arena_capacity = in->arena_capacity;
583  // the returned err will be added to, so we ensure this is room to avoid
584  // unneeded allocations.
585  if (in->arena_capacity - in->arena_size <
586  static_cast<uint8_t> SLOTS_PER_STR) {
587  new_arena_capacity = static_cast<uint8_t>(3 * new_arena_capacity / 2);
588  }
589  out = static_cast<grpc_error_handle>(
590  gpr_malloc(sizeof(*in) + new_arena_capacity * sizeof(intptr_t)));
591 #ifndef NDEBUG
593  gpr_log(GPR_DEBUG, "%p create copying %p", out, in);
594  }
595 #endif
596  // bulk memcpy of the rest of the struct.
597  // NOLINTNEXTLINE(bugprone-sizeof-expression)
598  size_t skip = sizeof(&out->atomics);
599  memcpy(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(out) + skip),
600  reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(in) + skip),
601  sizeof(*in) + (in->arena_size * sizeof(intptr_t)) - skip);
602  // manually set the atomics and the new capacity
603  gpr_atm_no_barrier_store(&out->atomics.error_string, 0);
604  gpr_ref_init(&out->atomics.refs, 1);
605  out->arena_capacity = new_arena_capacity;
606  ref_strs(out);
607  ref_errs(out);
609  }
610  return out;
611 }
612 
616  internal_set_int(&new_err, which, value);
617  return new_err;
618 }
619 
622  const char* msg;
623  size_t len;
624 };
626  {GRPC_STATUS_OK, "", 0}, // GRPC_ERROR_NONE
627  {GRPC_STATUS_INVALID_ARGUMENT, "", 0}, // GRPC_ERROR_RESERVED_1
628  {GRPC_STATUS_RESOURCE_EXHAUSTED, "RESOURCE_EXHAUSTED",
629  strlen("RESOURCE_EXHAUSTED")}, // GRPC_ERROR_OOM
630  {GRPC_STATUS_INVALID_ARGUMENT, "", 0}, // GRPC_ERROR_RESERVED_2
631  {GRPC_STATUS_CANCELLED, "CANCELLED",
632  strlen("CANCELLED")}, // GRPC_ERROR_CANCELLED
633 };
634 
636  intptr_t* p) {
637  if (grpc_error_is_special(err)) {
638  if (which != GRPC_ERROR_INT_GRPC_STATUS) return false;
639  *p = error_status_map[reinterpret_cast<size_t>(err)].code;
640  return true;
641  }
642  uint8_t slot = err->ints[which];
643  if (slot != UINT8_MAX) {
644  if (p != nullptr) *p = err->arena[slot];
645  return true;
646  }
647  return false;
648 }
649 
654  internal_set_str(&new_err, which,
655  grpc_slice_from_copied_buffer(str.data(), str.length()));
656  return new_err;
657 }
658 
660  std::string* s) {
661  if (grpc_error_is_special(err)) {
662  if (which != GRPC_ERROR_STR_GRPC_MESSAGE) return false;
664  error_status_map[reinterpret_cast<size_t>(err)];
665  *s = std::string(msg.msg, msg.len);
666  return true;
667  }
668  uint8_t slot = err->strs[which];
669  if (slot != UINT8_MAX) {
670  grpc_slice* slice = reinterpret_cast<grpc_slice*>(err->arena + slot);
672  return true;
673  } else {
674  return false;
675  }
676 }
677 
680  if (!GRPC_ERROR_IS_NONE(src)) {
681  if (GRPC_ERROR_IS_NONE(child)) {
682  /* \a child is empty. Simply return the ref to \a src */
683  return src;
684  } else if (child != src) {
686  internal_add_error(&new_err, child);
687  return new_err;
688  } else {
689  /* \a src and \a child are the same. Drop one of the references and return
690  * the other */
692  return src;
693  }
694  } else {
695  /* \a src is empty. Simply return the ref to \a child */
696  return child;
697  }
698 }
699 
700 static const char* no_error_string = "\"OK\"";
701 static const char* oom_error_string = "\"RESOURCE_EXHAUSTED\"";
702 static const char* cancelled_error_string = "\"CANCELLED\"";
703 
704 struct kv_pair {
705  char* key;
706  char* value;
707 };
708 struct kv_pairs {
710  size_t num_kvs;
711  size_t cap_kvs;
712 };
713 static void append_chr(char c, char** s, size_t* sz, size_t* cap) {
714  if (*sz == *cap) {
715  *cap = std::max(size_t(8), 3 * *cap / 2);
716  *s = static_cast<char*>(gpr_realloc(*s, *cap));
717  }
718  (*s)[(*sz)++] = c;
719 }
720 
721 static void append_str(const char* str, char** s, size_t* sz, size_t* cap) {
722  for (const char* c = str; *c; c++) {
723  append_chr(*c, s, sz, cap);
724  }
725 }
726 
727 static void append_esc_str(const uint8_t* str, size_t len, char** s, size_t* sz,
728  size_t* cap) {
729  static const char* hex = "0123456789abcdef";
730  append_chr('"', s, sz, cap);
731  for (size_t i = 0; i < len; i++, str++) {
732  if (*str < 32 || *str >= 127) {
733  append_chr('\\', s, sz, cap);
734  switch (*str) {
735  case '\b':
736  append_chr('b', s, sz, cap);
737  break;
738  case '\f':
739  append_chr('f', s, sz, cap);
740  break;
741  case '\n':
742  append_chr('n', s, sz, cap);
743  break;
744  case '\r':
745  append_chr('r', s, sz, cap);
746  break;
747  case '\t':
748  append_chr('t', s, sz, cap);
749  break;
750  default:
751  append_chr('u', s, sz, cap);
752  append_chr('0', s, sz, cap);
753  append_chr('0', s, sz, cap);
754  append_chr(hex[*str >> 4], s, sz, cap);
755  append_chr(hex[*str & 0x0f], s, sz, cap);
756  break;
757  }
758  } else {
759  append_chr(static_cast<char>(*str), s, sz, cap);
760  }
761  }
762  append_chr('"', s, sz, cap);
763 }
764 
765 static void append_kv(kv_pairs* kvs, char* key, char* value) {
766  if (kvs->num_kvs == kvs->cap_kvs) {
767  kvs->cap_kvs = std::max(3 * kvs->cap_kvs / 2, size_t(4));
768  kvs->kvs = static_cast<kv_pair*>(
769  gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs));
770  }
771  kvs->kvs[kvs->num_kvs].key = key;
772  kvs->kvs[kvs->num_kvs].value = value;
773  kvs->num_kvs++;
774 }
775 
778 }
779 
780 static char* fmt_int(intptr_t p) {
781  char* s;
782  gpr_asprintf(&s, "%" PRIdPTR, p);
783  return s;
784 }
785 
787  for (size_t which = 0; which < GRPC_ERROR_INT_MAX; ++which) {
788  uint8_t slot = err->ints[which];
789  if (slot != UINT8_MAX) {
790  append_kv(kvs, key_int(static_cast<grpc_error_ints>(which)),
791  fmt_int(err->arena[slot]));
792  }
793  }
794 }
795 
798 }
799 
800 static char* fmt_str(const grpc_slice& slice) {
801  char* s = nullptr;
802  size_t sz = 0;
803  size_t cap = 0;
805  &cap);
806  append_chr(0, &s, &sz, &cap);
807  return s;
808 }
809 
811  for (size_t which = 0; which < GRPC_ERROR_STR_MAX; ++which) {
812  uint8_t slot = err->strs[which];
813  if (slot != UINT8_MAX) {
814  append_kv(kvs, key_str(static_cast<grpc_error_strs>(which)),
815  fmt_str(*reinterpret_cast<grpc_slice*>(err->arena + slot)));
816  }
817  }
818 }
819 
822 }
823 
824 static char* fmt_time(gpr_timespec tm) {
825  char* out;
826  const char* pfx = "!!";
827  switch (tm.clock_type) {
828  case GPR_CLOCK_MONOTONIC:
829  pfx = "@monotonic:";
830  break;
831  case GPR_CLOCK_REALTIME:
832  pfx = "@";
833  break;
834  case GPR_CLOCK_PRECISE:
835  pfx = "@precise:";
836  break;
837  case GPR_TIMESPAN:
838  pfx = "";
839  break;
840  }
841  gpr_asprintf(&out, "\"%s%" PRId64 ".%09d\"", pfx, tm.tv_sec, tm.tv_nsec);
842  return out;
843 }
844 
846  for (size_t which = 0; which < GRPC_ERROR_TIME_MAX; ++which) {
847  uint8_t slot = err->times[which];
848  if (slot != UINT8_MAX) {
849  append_kv(kvs, key_time(static_cast<grpc_error_times>(which)),
850  fmt_time(*reinterpret_cast<gpr_timespec*>(err->arena + slot)));
851  }
852  }
853 }
854 
855 static void add_errs(grpc_error_handle err, char** s, size_t* sz, size_t* cap) {
856  uint8_t slot = err->first_err;
857  bool first = true;
858  while (slot != UINT8_MAX) {
859  grpc_linked_error* lerr =
860  reinterpret_cast<grpc_linked_error*>(err->arena + slot);
861  if (!first) append_chr(',', s, sz, cap);
862  first = false;
863  const char* e = grpc_error_string(lerr->err);
864  append_str(e, s, sz, cap);
865  GPR_ASSERT(err->last_err == slot ? lerr->next == UINT8_MAX
866  : lerr->next != UINT8_MAX);
867  slot = lerr->next;
868  }
869 }
870 
872  char* s = nullptr;
873  size_t sz = 0;
874  size_t cap = 0;
875  append_chr('[', &s, &sz, &cap);
876  add_errs(err, &s, &sz, &cap);
877  append_chr(']', &s, &sz, &cap);
878  append_chr(0, &s, &sz, &cap);
879  return s;
880 }
881 
882 static int cmp_kvs(const void* a, const void* b) {
883  const kv_pair* ka = static_cast<const kv_pair*>(a);
884  const kv_pair* kb = static_cast<const kv_pair*>(b);
885  return strcmp(ka->key, kb->key);
886 }
887 
888 static char* finish_kvs(kv_pairs* kvs) {
889  char* s = nullptr;
890  size_t sz = 0;
891  size_t cap = 0;
892 
893  append_chr('{', &s, &sz, &cap);
894  for (size_t i = 0; i < kvs->num_kvs; i++) {
895  if (i != 0) append_chr(',', &s, &sz, &cap);
896  append_esc_str(reinterpret_cast<const uint8_t*>(kvs->kvs[i].key),
897  strlen(kvs->kvs[i].key), &s, &sz, &cap);
898  gpr_free(kvs->kvs[i].key);
899  append_chr(':', &s, &sz, &cap);
900  append_str(kvs->kvs[i].value, &s, &sz, &cap);
901  gpr_free(kvs->kvs[i].value);
902  }
903  append_chr('}', &s, &sz, &cap);
904  append_chr(0, &s, &sz, &cap);
905 
906  gpr_free(kvs->kvs);
907  return s;
908 }
909 
912  if (err == GRPC_ERROR_OOM) return oom_error_string;
914 
915  void* p =
916  reinterpret_cast<void*>(gpr_atm_acq_load(&err->atomics.error_string));
917  if (p != nullptr) {
918  return static_cast<const char*>(p);
919  }
920 
921  kv_pairs kvs;
922  memset(&kvs, 0, sizeof(kvs));
923 
924  collect_ints_kvs(err, &kvs);
925  collect_strs_kvs(err, &kvs);
926  collect_times_kvs(err, &kvs);
927  if (err->first_err != UINT8_MAX) {
928  append_kv(&kvs, gpr_strdup("referenced_errors"), errs_string(err));
929  }
930 
931  qsort(kvs.kvs, kvs.num_kvs, sizeof(kv_pair), cmp_kvs);
932 
933  char* out = finish_kvs(&kvs);
934 
935  if (!gpr_atm_rel_cas(&err->atomics.error_string, 0,
936  reinterpret_cast<gpr_atm>(out))) {
937  gpr_free(out);
938  out = reinterpret_cast<char*>(gpr_atm_acq_load(&err->atomics.error_string));
939  }
940 
941  return out;
942 }
943 
946 }
947 
949  const char* call_name) {
950  return grpc_error_set_str(
955  nullptr, 0),
957  GRPC_ERROR_STR_OS_ERROR, strerror(err)),
958  GRPC_ERROR_STR_SYSCALL, call_name);
959 }
960 
961 #ifdef GPR_WINDOWS
962 grpc_error_handle grpc_wsa_error(const char* file, int line, int err,
963  const char* call_name) {
964  char* utf8_message = gpr_format_message(err);
970  grpc_slice_from_static_string("OS Error"),
971  NULL, 0),
973  GRPC_ERROR_STR_OS_ERROR, utf8_message),
974  GRPC_ERROR_STR_SYSCALL, call_name),
976  gpr_free(utf8_message);
977  return error;
978 }
979 #endif
980 
981 bool grpc_log_error(const char* what, grpc_error_handle error, const char* file,
982  int line) {
984  const char* msg = grpc_error_string(error);
985  gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "%s: %s", what, msg);
987  return false;
988 }
989 
990 #endif // GRPC_ERROR_IS_ABSEIL_STATUS
trace.h
xds_interop_client.str
str
Definition: xds_interop_client.py:487
GRPC_ERROR_INT_WSA_ERROR
@ GRPC_ERROR_INT_WSA_ERROR
WSAGetLastError() reported when this error occurred.
Definition: error.h:83
GPR_TIMESPAN
@ GPR_TIMESPAN
Definition: gpr_types.h:45
absl::Cord
Definition: abseil-cpp/absl/strings/cord.h:150
GRPC_ERROR_STR_SYSCALL
@ GRPC_ERROR_STR_SYSCALL
syscall that generated this error
Definition: error.h:114
absl::StatusCode::kResourceExhausted
@ kResourceExhausted
kv_pairs::num_kvs
size_t num_kvs
Definition: error.cc:710
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
fmt_str
static char * fmt_str(const grpc_slice &slice)
Definition: error.cc:800
gpr_atm_no_barrier_load
#define gpr_atm_no_barrier_load(p)
Definition: impl/codegen/atm_gcc_atomic.h:53
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
gpr_atm_no_barrier_store
#define gpr_atm_no_barrier_store(p, value)
Definition: impl/codegen/atm_gcc_atomic.h:56
error_internal.h
GRPC_STATUS_UNAVAILABLE
@ GRPC_STATUS_UNAVAILABLE
Definition: include/grpc/impl/codegen/status.h:143
grpc_slice_ref_internal
const grpc_slice & grpc_slice_ref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:32
grpc_core::StatusIntProperty::kRpcStatus
@ kRpcStatus
grpc status code representing this error
grpc_core::DebugLocation
Definition: debug_location.h:31
GRPC_ERROR_STR_FILE
@ GRPC_ERROR_STR_FILE
source file in which this error occurred
Definition: error.h:109
memset
return memset(p, 0, total)
grpc_error_create
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.
Definition: error.cc:489
GPR_DEBUG_ASSERT
#define GPR_DEBUG_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:103
internal_set_int
static void internal_set_int(grpc_error_handle *err, grpc_error_ints which, intptr_t value)
Definition: error.cc:397
grpc_disable_error_creation
void grpc_disable_error_creation()
Definition: error.cc:45
mkowners.skip
bool skip
Definition: mkowners.py:224
GRPC_ERROR_STR_MAX
@ GRPC_ERROR_STR_MAX
Must always be last.
Definition: error.h:137
grpc_linked_error
Definition: error_internal.h:35
GRPC_ERROR_INT_LB_POLICY_DROP
@ GRPC_ERROR_INT_LB_POLICY_DROP
LB policy drop.
Definition: error.h:97
grpc_error_times
grpc_error_times
Definition: error.h:140
kv_pairs::cap_kvs
size_t cap_kvs
Definition: error.cc:711
grpc_core::StatusAddChild
void StatusAddChild(absl::Status *status, absl::Status child)
Adds a child status to status.
Definition: status_helper.cc:256
GRPC_ERROR_INT_HTTP2_ERROR
@ GRPC_ERROR_INT_HTTP2_ERROR
http2 error code associated with the error (see the HTTP2 RFC)
Definition: error.h:77
grpc_core::StatusStrProperty::kOsError
@ kOsError
operating system description of this error
GRPC_ERROR_INT_INDEX
@ GRPC_ERROR_INT_INDEX
context sensitive index associated with the error
Definition: error.h:73
error_status_map
const special_error_status_map error_status_map[]
Definition: error.cc:625
copy_error_and_unref
static grpc_error_handle copy_error_and_unref(grpc_error_handle in)
Definition: error.cc:563
string.h
SURPLUS_CAPACITY
#define SURPLUS_CAPACITY
Definition: error.cc:487
GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE
@ GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE
channel connectivity state associated with the error
Definition: error.h:94
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_core::StringViewFromSlice
absl::string_view StringViewFromSlice(const grpc_slice &slice)
Definition: slice_internal.h:93
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
useful.h
finish_kvs
static char * finish_kvs(kv_pairs *kvs)
Definition: error.cc:888
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
oom_error_string
static const char * oom_error_string
Definition: error.cc:701
grpc_status_code
grpc_status_code
Definition: include/grpc/impl/codegen/status.h:28
DEFAULT_ERROR_CAPACITY
#define DEFAULT_ERROR_CAPACITY
Definition: error.cc:483
no_error_string
static const char * no_error_string
Definition: error.cc:700
error_ref_leak.err
err
Definition: error_ref_leak.py:35
gpr_format_message
GPRAPI char * gpr_format_message(int messageid)
grpc_linked_error::next
uint8_t next
Definition: error_internal.h:37
gpr_atm_rel_cas
#define gpr_atm_rel_cas(p, o, n)
Definition: impl/codegen/atm_gcc_sync.h:76
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
gpr_malloc
GPRAPI void * gpr_malloc(size_t size)
Definition: alloc.cc:29
grpc_linked_error::err
grpc_error_handle err
Definition: error_internal.h:36
GRPC_STATUS_CANCELLED
@ GRPC_STATUS_CANCELLED
Definition: include/grpc/impl/codegen/status.h:33
grpc_core::StatusCreate
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.
Definition: status_helper.cc:168
kv_pair::key
char * key
Definition: error.cc:705
absl::FormatConversionChar::s
@ s
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
GRPC_ERROR_INT_FD
@ GRPC_ERROR_INT_FD
File descriptor associated with this error.
Definition: error.h:86
append_esc_str
static void append_esc_str(const uint8_t *str, size_t len, char **s, size_t *sz, size_t *cap)
Definition: error.cc:727
grpc_core::StatusStrProperty::kSyscall
@ kSyscall
syscall that generated this error
GRPC_ERROR_STR_RAW_BYTES
@ GRPC_ERROR_STR_RAW_BYTES
hex dump (or similar) with the data that generated this error
Definition: error.h:123
xds_manager.p
p
Definition: xds_manager.py:60
cmp_kvs
static int cmp_kvs(const void *a, const void *b)
Definition: error.cc:882
GRPC_ERROR_CANCELLED
#define GRPC_ERROR_CANCELLED
Definition: error.h:238
GRPC_STATUS_INVALID_ARGUMENT
@ GRPC_STATUS_INVALID_ARGUMENT
Definition: include/grpc/impl/codegen/status.h:46
GRPC_STATUS_RESOURCE_EXHAUSTED
@ GRPC_STATUS_RESOURCE_EXHAUSTED
Definition: include/grpc/impl/codegen/status.h:76
g_error_creation_allowed
static gpr_atm g_error_creation_allowed
Definition: error.cc:43
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
kv_pairs::kvs
kv_pair * kvs
Definition: error.cc:709
errs_string
static char * errs_string(grpc_error_handle err)
Definition: error.cc:871
special_error_status_map::msg
const char * msg
Definition: error.cc:622
GRPC_ERROR_STR_DESCRIPTION
@ GRPC_ERROR_STR_DESCRIPTION
top-level textual description of this error
Definition: error.h:106
grpc_core::StatusGetStr
absl::optional< std::string > StatusGetStr(const absl::Status &status, StatusStrProperty key)
Gets the str property from the status.
Definition: status_helper.cc:217
GRPC_ERROR_INT_TSI_CODE
@ GRPC_ERROR_INT_TSI_CODE
TSI status code associated with the error.
Definition: error.h:80
kv_pair::key
const char * key
Definition: examples/cpp/keyvaluestore/server.cc:42
grpc_error_set_str
grpc_error_handle grpc_error_set_str(grpc_error_handle src, grpc_error_strs which, absl::string_view str)
Definition: error.cc:650
GRPC_ERROR_STR_TARGET_ADDRESS
@ GRPC_ERROR_STR_TARGET_ADDRESS
peer that we were trying to communicate when this error occurred
Definition: error.h:117
string_util.h
grpc_trace_closure
grpc_core::DebugOnlyTraceFlag grpc_trace_closure(false, "closure")
collect_ints_kvs
static void collect_ints_kvs(grpc_error_handle err, kv_pairs *kvs)
Definition: error.cc:786
grpc_error_add_child
grpc_error_handle grpc_error_add_child(grpc_error_handle src, grpc_error_handle child)
Definition: error.cc:678
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
in
const char * in
Definition: third_party/abseil-cpp/absl/strings/internal/str_format/parser_test.cc:391
grpc_core::StatusSetInt
void StatusSetInt(absl::Status *status, StatusIntProperty key, intptr_t value)
Sets the int property to the status.
Definition: status_helper.cc:187
grpc_error_do_ref
grpc_error_handle grpc_error_do_ref(grpc_error_handle err, const char *file, int line)
Definition: error.cc:303
UINT8_MAX
#define UINT8_MAX
Definition: stdint-msvc2008.h:140
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
GRPC_ERROR_TIME_CREATED
@ GRPC_ERROR_TIME_CREATED
timestamp of error creation
Definition: error.h:142
GRPC_STATUS_OK
@ GRPC_STATUS_OK
Definition: include/grpc/impl/codegen/status.h:30
key_int
static char * key_int(grpc_error_ints which)
Definition: error.cc:776
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
collect_times_kvs
static void collect_times_kvs(grpc_error_handle err, kv_pairs *kvs)
Definition: error.cc:845
gpr_realloc
GPRAPI void * gpr_realloc(void *p, size_t size)
Definition: alloc.cc:56
grpc_wsa_error
grpc_error_handle grpc_wsa_error(const char *file, int line, int err, const char *call_name) GRPC_MUST_USE_RESULT
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
SLOTS_PER_STR
#define SLOTS_PER_STR
Definition: error.cc:477
grpc_core::StatusToString
std::string StatusToString(const absl::Status &status)
Definition: status_helper.cc:282
grpc_log_error
bool grpc_log_error(const char *what, grpc_error_handle error, const char *file, int line)
Definition: error.cc:981
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
internal_add_error
static void internal_add_error(grpc_error_handle *err, grpc_error_handle new_err)
Definition: error.cc:452
absl::UnknownError
Status UnknownError(absl::string_view message)
Definition: third_party/abseil-cpp/absl/status/status.cc:383
gpr_atm_acq_load
#define gpr_atm_acq_load(p)
Definition: impl/codegen/atm_gcc_atomic.h:52
GRPC_ERROR_INT_SIZE
@ GRPC_ERROR_INT_SIZE
context sensitive size associated with the error
Definition: error.h:75
python_utils.jobset.which
def which(filename)
Definition: jobset.py:157
absl::optional
Definition: abseil-cpp/absl/types/internal/optional.h:61
GRPC_ERROR_INT_STREAM_ID
@ GRPC_ERROR_INT_STREAM_ID
Definition: error.h:63
GRPC_SLICE_START_PTR
#define GRPC_SLICE_START_PTR(slice)
Definition: include/grpc/impl/codegen/slice.h:101
append_str
static void append_str(const char *str, char **s, size_t *sz, size_t *cap)
Definition: error.cc:721
grpc_core::StatusIntProperty::kWsaError
@ kWsaError
WSAGetLastError() reported when this error occurred.
grpc_slice_from_static_string
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
Definition: slice/slice.cc:89
grpc_error_get_int
bool grpc_error_get_int(grpc_error_handle err, grpc_error_ints which, intptr_t *p)
Definition: error.cc:635
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
GRPC_ERROR_STR_GRPC_MESSAGE
@ GRPC_ERROR_STR_GRPC_MESSAGE
grpc status message associated with this error
Definition: error.h:120
GPR_CLOCK_MONOTONIC
@ GPR_CLOCK_MONOTONIC
Definition: gpr_types.h:36
googletest-filter-unittest.child
child
Definition: bloaty/third_party/googletest/googletest/test/googletest-filter-unittest.py:62
intptr_t
_W64 signed int intptr_t
Definition: stdint-msvc2008.h:118
gpr_asprintf
GPRAPI int gpr_asprintf(char **strp, const char *format,...) GPR_PRINT_FORMAT_CHECK(2
grpc_core::StatusSetStr
void StatusSetStr(absl::Status *status, StatusStrProperty key, absl::string_view value)
Sets the str property to the status.
Definition: status_helper.cc:212
error.h
fmt_int
static char * fmt_int(intptr_t p)
Definition: error.cc:780
unref_errs
static void unref_errs(grpc_error_handle err)
Definition: error.cc:320
GPR_LOG_SEVERITY_ERROR
@ GPR_LOG_SEVERITY_ERROR
Definition: include/grpc/impl/codegen/log.h:48
get_placement
static uint8_t get_placement(grpc_error_handle *err, size_t size)
Definition: error.cc:370
uintptr_t
_W64 unsigned int uintptr_t
Definition: stdint-msvc2008.h:119
slice_internal.h
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
GPR_UNREACHABLE_CODE
#define GPR_UNREACHABLE_CODE(STATEMENT)
Definition: impl/codegen/port_platform.h:652
GRPC_ERROR_INT_MAX
@ GRPC_ERROR_INT_MAX
Must always be last.
Definition: error.h:101
min
#define min(a, b)
Definition: qsort.h:83
GRPC_ERROR_INT_OFFSET
@ GRPC_ERROR_INT_OFFSET
Definition: error.h:70
error_time_name
static const char * error_time_name(grpc_error_times key)
Definition: error.cc:292
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
qsort
void qsort(void *a, size_t n, size_t es, int(*cmp)(const void *, const void *))
Definition: qsort.h:130
gpr_now
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
ref_errs
static void ref_errs(grpc_error_handle err)
Definition: error.cc:553
status.h
internal_set_time
static void internal_set_time(grpc_error_handle *err, grpc_error_times which, gpr_timespec value)
Definition: error.cc:433
key_str
static char * key_str(grpc_error_strs which)
Definition: error.cc:796
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
append_kv
static void append_kv(kv_pairs *kvs, char *key, char *value)
Definition: error.cc:765
GRPC_SLICE_LENGTH
#define GRPC_SLICE_LENGTH(slice)
Definition: include/grpc/impl/codegen/slice.h:104
grpc_core::TraceFlag
Definition: debug/trace.h:63
GRPC_ERROR_STR_FILENAME
@ GRPC_ERROR_STR_FILENAME
filename that we were trying to read/write when this error occurred
Definition: error.h:129
tm
static uv_timer_t tm
Definition: test-tcp-open.c:41
grpc_core::TraceFlag::enabled
bool enabled()
Definition: debug/trace.h:82
GRPC_ERROR_STR_OS_ERROR
@ GRPC_ERROR_STR_OS_ERROR
operating system description of this error
Definition: error.h:111
value
const char * value
Definition: hpack_parser_table.cc:165
absl::Status
ABSL_NAMESPACE_BEGIN class ABSL_MUST_USE_RESULT Status
Definition: abseil-cpp/absl/status/internal/status_internal.h:36
grpc_slice_to_c_string
GPRAPI char * grpc_slice_to_c_string(grpc_slice s)
Definition: slice/slice.cc:35
grpc_os_error
grpc_error_handle grpc_os_error(const char *file, int line, int err, const char *call_name)
Definition: error.cc:948
GPR_CLOCK_PRECISE
@ GPR_CLOCK_PRECISE
Definition: gpr_types.h:42
special_error_status_map
Definition: error.cc:620
gpr_atm
intptr_t gpr_atm
Definition: impl/codegen/atm_gcc_atomic.h:32
absl::StatusCode::kOk
@ kOk
kv_pair::value
const char * value
Definition: examples/cpp/keyvaluestore/server.cc:43
unref_strs
static void unref_strs(grpc_error_handle err)
Definition: error.cc:332
grpc_slice_from_copied_buffer
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
Definition: slice/slice.cc:170
absl::StatusCode::kCancelled
@ kCancelled
GRPC_ERROR_REF
#define GRPC_ERROR_REF(err)
Definition: error.h:261
key
const char * key
Definition: hpack_parser_table.cc:164
SLOTS_PER_LINKED_ERROR
#define SLOTS_PER_LINKED_ERROR
Definition: error.cc:479
absl::StatusCode
StatusCode
Definition: third_party/abseil-cpp/absl/status/status.h:92
grpc_error_set_int
grpc_error_handle grpc_error_set_int(grpc_error_handle src, grpc_error_ints which, intptr_t value)
Definition: error.cc:613
append_chr
static void append_chr(char c, char **s, size_t *sz, size_t *cap)
Definition: error.cc:713
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
absl::Status
Definition: third_party/abseil-cpp/absl/status/status.h:424
absl::StatusCode::kUnknown
@ kUnknown
GRPC_ERROR_TIME_MAX
@ GRPC_ERROR_TIME_MAX
Must always be last.
Definition: error.h:145
ref_strs
static void ref_strs(grpc_error_handle err)
Definition: error.cc:543
alloc.h
kv_pairs
Definition: error.cc:708
error_str_name
static const char * error_str_name(grpc_error_strs key)
Definition: error.cc:262
first
StrT first
Definition: cxa_demangle.cpp:4884
GRPC_ERROR_INT_ERRNO
@ GRPC_ERROR_INT_ERRNO
'errno' from the operating system
Definition: error.h:56
internal_set_str
static void internal_set_str(grpc_error_handle *err, grpc_error_strs which, const grpc_slice &value)
Definition: error.cc:412
GRPC_ERROR_STR_TSI_ERROR
@ GRPC_ERROR_STR_TSI_ERROR
tsi error string associated with this error
Definition: error.h:126
kv_pair
Definition: examples/cpp/keyvaluestore/server.cc:41
cancelled_error_string
static const char * cancelled_error_string
Definition: error.cc:702
grpc_trace_error_refcount
grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount(false, "error_refcount")
regen-readme.line
line
Definition: regen-readme.py:30
grpc_error_string
const char * grpc_error_string(grpc_error_handle err)
Definition: error.cc:910
type_url
string * type_url
Definition: bloaty/third_party/protobuf/conformance/conformance_cpp.cc:72
log_windows.h
ok
bool ok
Definition: async_end2end_test.cc:197
GRPC_ERROR_STR_VALUE
@ GRPC_ERROR_STR_VALUE
value associated with the error
Definition: error.h:134
desc
#define desc
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:338
GRPC_ERROR_STR_KEY
@ GRPC_ERROR_STR_KEY
key associated with the error
Definition: error.h:132
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
grpc_error_strs
grpc_error_strs
Definition: error.h:104
grpc_error_is_special
bool grpc_error_is_special(grpc_error_handle err)
Definition: error.h:243
GRPC_ERROR_INT_FILE_LINE
@ GRPC_ERROR_INT_FILE_LINE
LINE from the call site creating the error
Definition: error.h:59
grpc_core::StatusStrProperty
StatusStrProperty
This enum should have the same value of grpc_error_strs.
Definition: status_helper.h:83
gpr_strdup
GPRAPI char * gpr_strdup(const char *src)
Definition: string.cc:39
grpc_error_do_unref
void grpc_error_do_unref(grpc_error_handle err, const char *file, int line)
Definition: error.cc:352
add_errs
static void add_errs(grpc_error_handle err, char **s, size_t *sz, size_t *cap)
Definition: error.cc:855
GPR_DEBUG
#define GPR_DEBUG
Definition: include/grpc/impl/codegen/log.h:55
grpc_error_ints
grpc_error_ints
Definition: error.h:54
grpc_core::StatusGetInt
absl::optional< intptr_t > StatusGetInt(const absl::Status &status, StatusIntProperty key)
Gets the int property from the status.
Definition: status_helper.cc:192
error_destroy
static void error_destroy(grpc_error_handle err)
Definition: error.cc:342
gpr_ref_init
GPRAPI void gpr_ref_init(gpr_refcount *r, int n)
Definition: sync.cc:86
GRPC_ERROR_INT_OCCURRED_DURING_WRITE
@ GRPC_ERROR_INT_OCCURRED_DURING_WRITE
chttp2: did the error occur while a write was in progress
Definition: error.h:91
grpc_error_get_str
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.
Definition: error.cc:659
special_error_status_map::code
grpc_status_code code
Definition: error.cc:621
code
Definition: bloaty/third_party/zlib/contrib/infback9/inftree9.h:24
GRPC_ERROR_INT_HTTP_STATUS
@ GRPC_ERROR_INT_HTTP_STATUS
HTTP status (i.e. 404)
Definition: error.h:88
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
gpr_timespec
Definition: gpr_types.h:50
gpr_unref
GPRAPI int gpr_unref(gpr_refcount *r)
Definition: sync.cc:103
absl::StatusCode::kUnavailable
@ kUnavailable
grpc_error
Definition: error_internal.h:42
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
GRPC_ERROR_OOM
#define GRPC_ERROR_OOM
Definition: error.h:236
key_time
static char * key_time(grpc_error_times which)
Definition: error.cc:820
GPR_CLOCK_REALTIME
@ GPR_CLOCK_REALTIME
Definition: gpr_types.h:39
gen_server_registered_method_bad_client_test_body.payload
list payload
Definition: gen_server_registered_method_bad_client_test_body.py:40
grpc_core::StatusIntProperty
StatusIntProperty
This enum should have the same value of grpc_error_ints.
Definition: status_helper.h:45
children
std::map< std::string, Node * > children
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/field_mask_util.cc:257
error_int_name
static const char * error_int_name(grpc_error_ints key)
Definition: error.cc:224
gpr_ref
GPRAPI void gpr_ref(gpr_refcount *r)
Definition: sync.cc:88
gpr_ref_is_unique
GPRAPI int gpr_ref_is_unique(gpr_refcount *r)
Definition: sync.cc:109
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
GRPC_ERROR_INT_GRPC_STATUS
@ GRPC_ERROR_INT_GRPC_STATUS
grpc status code representing this error
Definition: error.h:66
special_error_status_map::len
size_t len
Definition: error.cc:623
kv_pair::value
char * value
Definition: error.cc:706
grpc_slice_unref_internal
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:39
collect_strs_kvs
static void collect_strs_kvs(grpc_error_handle err, kv_pairs *kvs)
Definition: error.cc:810
grpc_core::StatusIntProperty::kErrorNo
@ kErrorNo
'errno' from the operating system
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
grpc_enable_error_creation
void grpc_enable_error_creation()
Definition: error.cc:49
port_platform.h
fmt_time
static char * fmt_time(gpr_timespec tm)
Definition: error.cc:824


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:15