Minor changes in utils::Status (#9288)

* Minor changes in utils::Status

- << operator doesn't have to be friend
- simplify getErrorMessage to not use strlen internally

* Replace std::ostream to utils::io::ostream
This commit is contained in:
yein
2025-10-03 12:53:46 -07:00
committed by GitHub
parent 0b011fae7d
commit a4746eab0c
2 changed files with 9 additions and 9 deletions
+4 -6
View File
@@ -15,13 +15,11 @@
*/
#include <utils/Status.h>
namespace utils {
std::string_view Status::getErrorMessage() const {
const char* ptr = mErrorMessage.c_str();
return (ptr != nullptr) ? ptr : "";
}
#include <utils/ostream.h>
std::ostream& operator<<(std::ostream& os, const Status& status) {
namespace utils {
utils::io::ostream& operator<<(utils::io::ostream& os, const Status& status) {
os << "Status: ";
switch (status.getCode()) {
case StatusCode::OK: os << "Ok";