0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

better assert string()

This commit is contained in:
Eliot Horowitz 2010-05-11 15:18:07 -04:00
parent e9f05dd091
commit 0edfb44bbf
4 changed files with 9 additions and 9 deletions

View File

@ -78,7 +78,7 @@ namespace mongo {
class SyncException : public DBException {
public:
virtual const char* what() const throw() { return "sync exception"; }
virtual int getCode(){ return 10001; }
virtual int getCode() const { return 10001; }
};
/* A Source is a source from which we can pull (replicate) data.

View File

@ -88,8 +88,8 @@ namespace mongo {
virtual string toString() const {
return what();
}
virtual int getCode() = 0;
operator string() const { return toString(); }
virtual int getCode() const = 0;
operator string() const { stringstream ss; ss << getCode() << " " << what(); return ss.str(); }
};
class AssertionException : public DBException {
@ -104,7 +104,7 @@ namespace mongo {
virtual bool isUserAssertion() {
return false;
}
virtual int getCode(){ return code; }
virtual int getCode() const { return code; }
virtual const char* what() const throw() { return msg.c_str(); }
/* true if an interrupted exception - see KillCurrentOp */

View File

@ -242,7 +242,7 @@ namespace mongo {
class SocketException : public DBException {
public:
virtual const char* what() const throw() { return "socket exception"; }
virtual int getCode(){ return 9001; }
virtual int getCode() const { return 9001; }
};
MSGID nextMessageId();

View File

@ -22,13 +22,13 @@
namespace mongo {
void exitCleanly( int code );
/* Operation sequence #. A combination of current second plus an ordinal value.
*/
struct ClockSkewException : public DBException {
virtual const char* what() const throw() { return "clock skew exception"; }
virtual int getCode(){ return 20001; }
virtual int getCode() const { return 20001; }
};
/* Operation sequence #. A combination of current second plus an ordinal value.
*/
#pragma pack(4)
class OpTime {
unsigned i;