diff options
Diffstat (limited to 'absl/status/status.h')
-rw-r--r-- | absl/status/status.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/absl/status/status.h b/absl/status/status.h index c6c1cd41..595064c0 100644 --- a/absl/status/status.h +++ b/absl/status/status.h @@ -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 |