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:
parent
e9f05dd091
commit
0edfb44bbf
@ -78,7 +78,7 @@ namespace mongo {
|
|||||||
class SyncException : public DBException {
|
class SyncException : public DBException {
|
||||||
public:
|
public:
|
||||||
virtual const char* what() const throw() { return "sync exception"; }
|
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.
|
/* A Source is a source from which we can pull (replicate) data.
|
||||||
|
@ -88,8 +88,8 @@ namespace mongo {
|
|||||||
virtual string toString() const {
|
virtual string toString() const {
|
||||||
return what();
|
return what();
|
||||||
}
|
}
|
||||||
virtual int getCode() = 0;
|
virtual int getCode() const = 0;
|
||||||
operator string() const { return toString(); }
|
operator string() const { stringstream ss; ss << getCode() << " " << what(); return ss.str(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class AssertionException : public DBException {
|
class AssertionException : public DBException {
|
||||||
@ -104,7 +104,7 @@ namespace mongo {
|
|||||||
virtual bool isUserAssertion() {
|
virtual bool isUserAssertion() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual int getCode(){ return code; }
|
virtual int getCode() const { return code; }
|
||||||
virtual const char* what() const throw() { return msg.c_str(); }
|
virtual const char* what() const throw() { return msg.c_str(); }
|
||||||
|
|
||||||
/* true if an interrupted exception - see KillCurrentOp */
|
/* true if an interrupted exception - see KillCurrentOp */
|
||||||
|
@ -242,7 +242,7 @@ namespace mongo {
|
|||||||
class SocketException : public DBException {
|
class SocketException : public DBException {
|
||||||
public:
|
public:
|
||||||
virtual const char* what() const throw() { return "socket exception"; }
|
virtual const char* what() const throw() { return "socket exception"; }
|
||||||
virtual int getCode(){ return 9001; }
|
virtual int getCode() const { return 9001; }
|
||||||
};
|
};
|
||||||
|
|
||||||
MSGID nextMessageId();
|
MSGID nextMessageId();
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
namespace mongo {
|
namespace mongo {
|
||||||
void exitCleanly( int code );
|
void exitCleanly( int code );
|
||||||
|
|
||||||
/* Operation sequence #. A combination of current second plus an ordinal value.
|
|
||||||
*/
|
|
||||||
struct ClockSkewException : public DBException {
|
struct ClockSkewException : public DBException {
|
||||||
virtual const char* what() const throw() { return "clock skew exception"; }
|
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)
|
#pragma pack(4)
|
||||||
class OpTime {
|
class OpTime {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
Loading…
Reference in New Issue
Block a user