Google Cloud C++ Client
1.42.0
C++ Client Library for Google Cloud Platform
|
Represents success or an error with info about the error. More...
#include <google/cloud/status.h>
Public Member Functions | |
Status () | |
~Status () | |
Status (Status const &) | |
Status & | operator= (Status const &) |
Status (Status &&) noexcept | |
Status & | operator= (Status &&) noexcept |
Status (StatusCode code, std::string message, ErrorInfo info={}) | |
Constructs a Status with the given code and message . More... | |
bool | ok () const |
StatusCode | code () const |
std::string const & | message () const |
ErrorInfo const & | error_info () const |
Friends | |
bool | operator== (Status const &a, Status const &b) |
bool | operator!= (Status const &a, Status const &b) |
std::ostream & | operator<< (std::ostream &os, Status const &s) |
Represents success or an error with info about the error.
This class is typically used to indicate whether or not a function or other operation completed successfully. Success is indicated by an "OK" status. OK statuses will have .code() == StatusCode::kOk
and .ok() == true
, with all other properties having empty values. All OK statuses are equal. Any non-OK Status
is considered an error. Users can inspect the error using the member functions, or they can simply stream the Status
object, and it will print itself in some human readable way (the streamed format may change over time and you should not depend on the specific format of a streamed Status
object remaining unchanged).
This is a regular value type that can be copied, moved, compared for equality, and streamed.
google::cloud::Status::Status | ( | ) |
google::cloud::Status::~Status | ( | ) |
google::cloud::Status::Status | ( | Status const & | ) |
|
noexcept |
|
explicit |
Constructs a Status with the given code
and message
.
Ignores message
if code
is StatusCode::kOk
.
StatusCode google::cloud::Status::code | ( | ) | const |
ErrorInfo const& google::cloud::Status::error_info | ( | ) | const |
std::string const& google::cloud::Status::message | ( | ) | const |
|
friend |