21 #include "mongo/base/error_codes.h"
22 #include "mongo/client/export_macros.h"
23 #include "mongo/platform/atomic_word.h"
53 static inline Status MONGO_CLIENT_FUNC OK();
60 Status(ErrorCodes::Error code,
const std::string& reason,
int location = 0);
61 Status(ErrorCodes::Error code,
const char* reason,
int location = 0);
66 #if __cplusplus >= 201103L
69 #endif // __cplusplus >= 201103L
77 bool compare(
const Status& other)
const;
78 bool operator==(
const Status& other)
const;
79 bool operator!=(
const Status& other)
const;
85 bool compareCode(
const ErrorCodes::Error other)
const;
86 bool operator==(
const ErrorCodes::Error other)
const;
87 bool operator!=(
const ErrorCodes::Error other)
const;
93 inline bool isOK()
const;
95 inline ErrorCodes::Error code()
const;
97 inline std::string codeString()
const;
99 inline std::string reason()
const;
101 inline int location()
const;
103 std::string toString()
const;
109 inline AtomicUInt32::WordType refCount()
const;
116 const ErrorCodes::Error code;
117 const std::string reason;
120 static ErrorInfo* create(ErrorCodes::Error code,
const StringData& reason,
int location);
122 ErrorInfo(ErrorCodes::Error code,
const StringData& reason,
int location);
132 static inline void MONGO_CLIENT_FUNC ref(ErrorInfo* error);
133 static inline void MONGO_CLIENT_FUNC unref(ErrorInfo* error);
136 MONGO_CLIENT_API
inline bool MONGO_CLIENT_FUNC
137 operator==(
const ErrorCodes::Error lhs,
const Status& rhs);
139 MONGO_CLIENT_API
inline bool MONGO_CLIENT_FUNC
140 operator!=(
const ErrorCodes::Error lhs,
const Status& rhs);
146 MONGO_CLIENT_API std::ostream& MONGO_CLIENT_FUNC operator<<(std::ostream& os,
const Status& status);
147 MONGO_CLIENT_API std::ostream& MONGO_CLIENT_FUNC operator<<(std::ostream& os, ErrorCodes::Error);
151 #include "mongo/base/status-inl.h"
Status represents an error state or the absence thereof.
Definition: status.h:50
A StringData object wraps a 'const string&' or a 'const char*' without copying its contents...
Definition: string_data.h:43
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
MONGO_CLIENT_API Status(MONGO_CLIENT_FUNC *saslClientAuthenticate)(DBClientWithCommands *client
Attempts to authenticate "client" using the SASL protocol.