25 #include "google/protobuf/descriptor.h" 26 #include "modules/common/proto/error_code.pb.h" 52 : code_(
code), msg_(msg.data()) {}
73 ErrorCode
code()
const {
return code_; }
79 return (this->code_ == rh.code_) && (this->msg_ == rh.msg_);
102 return ErrorCode_Name(code_) +
": " + msg_;
109 void Save(StatusPb *status_pb) {
113 status_pb->set_error_code(code_);
115 status_pb->set_msg(msg_);
bool operator==(const Status &rh) const
defines the logic of testing if two Status are equal
Definition: status.h:78
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void Save(StatusPb *status_pb)
save the error_code and error message to protobuf
Definition: status.h:109
const std::string & error_message() const
returns the error message of the status, empty if the status is OK.
Definition: status.h:91
bool ok() const
check whether the return status is OK.
Definition: status.h:67
static Status OK()
generate a success status.
Definition: status.h:60
ErrorCode code() const
get the error code
Definition: status.h:73
std::ostream & operator<<(std::ostream &os, const Status &s)
Definition: status.h:124
A general class to denote the return status of an API call. It can either be an OK status for success...
Definition: status.h:43
bool operator!=(const Status &rh) const
defines the logic of testing if two Status are unequal
Definition: status.h:85
bool OK()
Definition: state.h:44
std::string ToString() const
returns a string representation in a readable format.
Definition: status.h:98
Status(ErrorCode code=ErrorCode::OK, std::string_view msg="")
Create a status with the specified error code and msg as a human-readable string containing more deta...
Definition: status.h:51