diff options
Diffstat (limited to 'src/mongo/base/status.cpp')
-rw-r--r-- | src/mongo/base/status.cpp | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/src/mongo/base/status.cpp b/src/mongo/base/status.cpp index 2eef1946e75..57aedd11749 100644 --- a/src/mongo/base/status.cpp +++ b/src/mongo/base/status.cpp @@ -33,49 +33,24 @@ namespace mongo { -Status::ErrorInfo::ErrorInfo(ErrorCodes::Error aCode, std::string aReason, int aLocation) - : code(aCode), reason(std::move(aReason)), location(aLocation) {} +Status::ErrorInfo::ErrorInfo(ErrorCodes::Error aCode, std::string aReason) + : code(aCode), reason(std::move(aReason)) {} -Status::ErrorInfo* Status::ErrorInfo::create(ErrorCodes::Error c, std::string r, int l) { +Status::ErrorInfo* Status::ErrorInfo::create(ErrorCodes::Error c, std::string r) { if (c == ErrorCodes::OK) return nullptr; - return new ErrorInfo(c, std::move(r), l); + return new ErrorInfo(c, std::move(r)); } -Status::Status(ErrorCodes::Error code, std::string reason, int location) - : _error(ErrorInfo::create(code, std::move(reason), location)) { +Status::Status(ErrorCodes::Error code, std::string reason) + : _error(ErrorInfo::create(code, std::move(reason))) { ref(_error); } -Status::Status(ErrorCodes::Error code, const char* reason, int location) - : Status(code, std::string(reason), location) {} +Status::Status(ErrorCodes::Error code, const char* reason) : Status(code, std::string(reason)) {} -Status::Status(ErrorCodes::Error code, const mongoutils::str::stream& reason, int location) - : Status(code, std::string(reason), location) {} - -bool Status::compare(const Status& other) const { - return code() == other.code() && location() == other.location(); -} - -bool Status::operator==(const Status& other) const { - return compare(other); -} - -bool Status::operator!=(const Status& other) const { - return !compare(other); -} - -bool Status::compareCode(const ErrorCodes::Error other) const { - return code() == other; -} - -bool Status::operator==(const ErrorCodes::Error other) const { - return compareCode(other); -} - -bool Status::operator!=(const ErrorCodes::Error other) const { - return !compareCode(other); -} +Status::Status(ErrorCodes::Error code, const mongoutils::str::stream& reason) + : Status(code, std::string(reason)) {} std::ostream& operator<<(std::ostream& os, const Status& status) { return os << status.codeString() << " " << status.reason(); @@ -90,8 +65,6 @@ std::string Status::toString() const { ss << codeString(); if (!isOK()) ss << ": " << reason(); - if (location() != 0) - ss << " @ " << location(); return ss.str(); } |