diff options
Diffstat (limited to 'absl/status/status.h')
-rw-r--r-- | absl/status/status.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/absl/status/status.h b/absl/status/status.h index 4e8292fc..595064c0 100644 --- a/absl/status/status.h +++ b/absl/status/status.h @@ -398,7 +398,7 @@ inline StatusToStringMode& operator^=(StatusToStringMode& lhs, // // * It may provide more fine-grained semantic information about the error to // facilitate actionable remedies. -// * It may provide human-readable contexual information that is more +// * It may provide human-readable contextual information that is more // appropriate to display to an end user. // // Example: @@ -538,7 +538,7 @@ class Status final { // // * It may provide more fine-grained semantic information about the error // to facilitate actionable remedies. - // * It may provide human-readable contexual information that is more + // * It may provide human-readable contextual information that is more // appropriate to display to an end user. // // A payload consists of a [key,value] pair, where the key is a string @@ -886,6 +886,15 @@ inline Status OkStatus() { return Status(); } // message-less kCancelled errors are common in the infrastructure. inline Status CancelledError() { return Status(absl::StatusCode::kCancelled); } +// Retrieves a message's status as a null terminated C string. The lifetime of +// this string is tied to the lifetime of the status object itself. +// +// If the status's message is empty, the empty string is returned. +// +// StatusMessageAsCStr exists for C support. Use `status.message()` in C++. +const char* StatusMessageAsCStr( + const Status& status ABSL_ATTRIBUTE_LIFETIME_BOUND); + ABSL_NAMESPACE_END } // namespace absl |