Skip to content

Commit

Permalink
better assert string()
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed May 11, 2010
1 parent e9f05dd commit 0edfb44
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion db/repl.h
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions util/assert_util.h
Expand Up @@ -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 {
Expand All @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion util/message.h
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions util/optime.h
Expand Up @@ -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;
Expand Down

0 comments on commit 0edfb44

Please sign in to comment.