mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
clean up exception classes
This commit is contained in:
parent
176c9a1e25
commit
4d5f0e9a78
@ -107,7 +107,9 @@ namespace mongo {
|
||||
#pragma pack()
|
||||
|
||||
/* A replication exception */
|
||||
struct SyncException {
|
||||
class SyncException : public DBException {
|
||||
public:
|
||||
virtual const char* what() const throw() { return "sync exception"; }
|
||||
};
|
||||
|
||||
/* A Source is a source from which we can pull (replicate) data.
|
||||
|
10
stdafx.h
10
stdafx.h
@ -107,11 +107,16 @@ namespace mongo {
|
||||
/* last assert of diff types: regular, wassert, msgassert, uassert: */
|
||||
extern Assertion lastAssert[4];
|
||||
|
||||
// you can catch these
|
||||
class AssertionException {
|
||||
class DBException : public exception {
|
||||
public:
|
||||
virtual const char* what() const throw() = 0;
|
||||
};
|
||||
|
||||
class AssertionException : public DBException {
|
||||
public:
|
||||
string msg;
|
||||
AssertionException() { }
|
||||
~AssertionException() throw() { }
|
||||
virtual bool severe() {
|
||||
return true;
|
||||
}
|
||||
@ -121,6 +126,7 @@ namespace mongo {
|
||||
virtual string toString() {
|
||||
return msg;
|
||||
}
|
||||
virtual const char* what() const throw() { return msg.c_str(); }
|
||||
};
|
||||
|
||||
/* we use the same mechanism for bad things the user does -- which are really just errors */
|
||||
|
@ -177,8 +177,9 @@ namespace mongo {
|
||||
bool freeIt;
|
||||
};
|
||||
|
||||
class SocketException {
|
||||
|
||||
class SocketException : public DBException {
|
||||
public:
|
||||
virtual const char* what() const throw() { return "socket exception"; }
|
||||
};
|
||||
|
||||
} // namespace mongo
|
||||
|
Loading…
Reference in New Issue
Block a user