diff --git a/db/repl.h b/db/repl.h index 396faf44ce8b5..efd16cbe5b9ce 100644 --- a/db/repl.h +++ b/db/repl.h @@ -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. diff --git a/util/assert_util.h b/util/assert_util.h index d10c1dc8e6acd..02426cc886ad3 100644 --- a/util/assert_util.h +++ b/util/assert_util.h @@ -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 */ diff --git a/util/message.h b/util/message.h index 9c226cb5defb1..2aa742bcf8e0f 100644 --- a/util/message.h +++ b/util/message.h @@ -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(); diff --git a/util/optime.h b/util/optime.h index 8b264340f8fb6..b913696ebc066 100644 --- a/util/optime.h +++ b/util/optime.h @@ -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;