Go to the documentation of this file.
28 #include "absl/strings/cord.h"
29 #include "absl/strings/escaping.h"
30 #include "absl/strings/match.h"
31 #include "absl/strings/numbers.h"
32 #include "absl/strings/str_cat.h"
33 #include "absl/strings/str_join.h"
34 #include "absl/time/clock.h"
49 #define TYPE_URL_PREFIX "type.googleapis.com/grpc.status."
50 #define TYPE_INT_TAG "int."
51 #define TYPE_STR_TAG "str."
52 #define TYPE_TIME_TAG "time."
53 #define TYPE_CHILDREN_TAG "children"
54 #define TYPE_URL(name) (TYPE_URL_PREFIX name)
136 buf[1] = (
v >> 8) & 0xFF;
137 buf[2] = (
v >> 16) & 0xFF;
138 buf[3] = (
v >> 24) & 0xFF;
142 const unsigned char* ubuf =
reinterpret_cast<const unsigned char*
>(
buf);
148 std::vector<absl::Status>
result;
155 size_t msg_size = DecodeUInt32FromBytes(
buf.data() +
cur);
170 std::vector<absl::Status>
children) {
172 if (location.
file() !=
nullptr) {
175 if (location.
line() != -1) {
270 EncodeUInt32ToBytes(buf_len, head_buf);
279 : std::vector<absl::Status>();
291 std::vector<std::string> kvs;
303 if (
payload.TryFlat().has_value()) {
304 payload_view = payload.TryFlat().value();
306 payload_storage = std::string(payload);
307 payload_view = payload_storage;
338 std::vector<absl::Status> children_status = ParseChildren(*
children);
339 std::vector<std::string> children_text;
340 children_text.reserve(children_status.size());
341 for (
const absl::Status& child_status : children_status) {
347 return kvs.empty() ? head
359 Slice message_percent_slice =
362 char* message_percent =
reinterpret_cast<char*
>(
364 if (message_percent_slice.
length() > 0) {
365 memcpy(message_percent, message_percent_slice.
data(),
366 message_percent_slice.
length());
370 message_percent_slice.
length()));
403 Slice message_slice =
408 message_slice.
size()));
412 for (
size_t i = 0;
i < detail_len;
i++) {
422 if (s.ok())
return 0;
struct google_rpc_Status google_rpc_Status
absl::Status StatusFromProto(google_rpc_Status *msg)
Slice PermissivePercentDecodeSlice(Slice slice_in)
@ kFileLine
LINE from the call site creating the error
UPB_INLINE int32_t google_rpc_Status_code(const google_rpc_Status *msg)
void StrAppend(std::string *dest, const AlphaNum &a)
@ kRpcStatus
grpc status code representing this error
@ kRawBytes
hex dump (or similar) with the data that generated this error
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
std::vector< absl::Status > StatusGetChildren(absl::Status status)
Returns all children status from a status.
@ kTsiCode
TSI status code associated with the error.
#define TYPE_CHILDREN_TAG
@ kFile
source file in which this error occurred
void StatusAddChild(absl::Status *status, absl::Status child)
Adds a child status to status.
@ kOsError
operating system description of this error
ABSL_NAMESPACE_BEGIN std::string StatusCodeToString(StatusCode code)
uintptr_t StatusAllocHeapPtr(absl::Status s)
UPB_INLINE struct google_protobuf_Any * google_rpc_Status_add_details(google_rpc_Status *msg, upb_Arena *arena)
bool StartsWith(absl::string_view text, absl::string_view prefix) noexcept
@ kCreated
timestamp of error creation
void StatusSetTime(absl::Status *status, StatusTimeProperty key, absl::Time time)
Sets the time property to the status.
@ kLbPolicyDrop
LB policy drop.
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.
@ kTsiError
tsi error string associated with this error
@ kSyscall
syscall that generated this error
UPB_INLINE void google_protobuf_Any_set_type_url(google_protobuf_Any *msg, upb_StringView value)
const char * file() const
absl::optional< std::string > StatusGetStr(const absl::Status &status, StatusStrProperty key)
Gets the str property from the status.
grpc_core::ScopedArenaPtr arena
std::string FormatTime(absl::string_view format, absl::Time t, absl::TimeZone tz)
struct google_protobuf_Any google_protobuf_Any
UPB_INLINE google_rpc_Status * google_rpc_Status_parse(const char *buf, size_t size, upb_Arena *arena)
ABSL_NAMESPACE_BEGIN ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view str, int_type *out)
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.
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
constexpr size_type size() const noexcept
constexpr bool has_value() const noexcept
std::string StatusToString(const absl::Status &status)
UPB_INLINE void * upb_Arena_Malloc(upb_Arena *a, size_t size)
@ kFilename
filename that we were trying to read/write when this error occurred
void SetPayload(absl::string_view type_url, absl::Cord payload)
bool ParseTime(absl::string_view format, absl::string_view input, absl::Time *time, std::string *err)
absl::string_view message() const
absl::Status StatusGetFromHeapPtr(uintptr_t ptr)
Get the status from a heap ptr.
ABSL_NAMESPACE_BEGIN const ABSL_DLL char RFC3339_full[]
const uint8_t * data() const
@ kWsaError
WSAGetLastError() reported when this error occurred.
void StatusSetStr(absl::Status *status, StatusStrProperty key, absl::string_view value)
Sets the str property to the status.
@ kDescription
top-level textual description of this error
_W64 unsigned int uintptr_t
void StatusFreeHeapPtr(uintptr_t ptr)
Frees the allocated status at heap ptr.
@ ChannelConnectivityState
channel connectivity state associated with the error
std::string CHexEscape(absl::string_view src)
UPB_INLINE const struct google_protobuf_Any *const * google_rpc_Status_details(const google_rpc_Status *msg, size_t *len)
@ kValue
value associated with the error
StatusTimeProperty
This enum should have the same value of grpc_error_times.
void ForEachPayload(absl::FunctionRef< void(absl::string_view, const absl::Cord &)> visitor) const
google_rpc_Status * StatusToProto(const absl::Status &status, upb_Arena *arena)
UPB_INLINE void google_rpc_Status_set_message(google_rpc_Status *msg, upb_StringView value)
static grpc_slice details
ABSL_NAMESPACE_BEGIN class ABSL_MUST_USE_RESULT Status
constexpr const T & value() const &
ABSL_NAMESPACE_BEGIN Time Now()
@ kGrpcMessage
grpc status message associated with this error
absl::optional< absl::Time > StatusGetTime(const absl::Status &status, StatusTimeProperty key)
Gets the time property from the status.
@ kKey
key associated with the error
UPB_INLINE void google_protobuf_Any_set_value(google_protobuf_Any *msg, upb_StringView value)
static Slice FromExternalString(absl::string_view str)
UniquePtr< SSL_SESSION > ret
UPB_INLINE upb_StringView upb_StringView_FromDataAndSize(const char *data, size_t size)
UPB_INLINE upb_StringView google_protobuf_Any_type_url(const google_protobuf_Any *msg)
@ kHttpStatus
HTTP status (i.e. 404)
UPB_INLINE upb_StringView google_rpc_Status_message(const google_rpc_Status *msg)
ABSL_MUST_USE_RESULT bool ok() const
absl::Status StatusMoveFromHeapPtr(uintptr_t ptr)
Move the status from a heap ptr. (GetFrom & FreeHeap)
@ kSize
context sensitive size associated with the error
absl::optional< absl::Cord > GetPayload(absl::string_view type_url) const
UPB_INLINE char * google_rpc_Status_serialize(const google_rpc_Status *msg, upb_Arena *arena, size_t *len)
StatusStrProperty
This enum should have the same value of grpc_error_strs.
constexpr bool empty() const noexcept
UPB_INLINE google_rpc_Status * google_rpc_Status_new(upb_Arena *arena)
absl::optional< intptr_t > StatusGetInt(const absl::Status &status, StatusIntProperty key)
Gets the int property from the status.
@ kOccurredDuringWrite
chttp2: did the error occur while a write was in progress
absl::StatusCode code() const
StatusIntProperty
This enum should have the same value of grpc_error_ints.
constexpr const_pointer data() const noexcept
static bool to_string(zval *from)
@ kHttp2Error
http2 error code associated with the error (see the HTTP2 RFC)
std::map< std::string, Node * > children
UPB_INLINE void google_rpc_Status_set_code(google_rpc_Status *msg, int32_t value)
if(p->owned &&p->wrapped !=NULL)
Slice PercentEncodeSlice(Slice slice, PercentEncodingType type)
@ kFd
File descriptor associated with this error.
@ kIndex
context sensitive index associated with the error
UPB_INLINE upb_StringView google_protobuf_Any_value(const google_protobuf_Any *msg)
@ kErrorNo
'errno' from the operating system
@ kTargetAddress
peer that we were trying to communicate when this error occurred
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:17