summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2018-01-17 13:31:14 -0500
committerMathias Stearn <mathias@10gen.com>2018-01-19 21:43:07 -0500
commit6d92ce0e7ec4e9a0cf31e9f9940a63b03968bb88 (patch)
treeee06bd3cd1d5f34b114c81bffb715e432fbe6880 /src/mongo/dbtests
parent410d6cf705eafd46499e8b338be5103becd377ff (diff)
downloadmongo-6d92ce0e7ec4e9a0cf31e9f9940a63b03968bb88.tar.gz
SERVER-32674 Make SocketException not be a special type
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/mock/mock_dbclient_connection.cpp4
-rw-r--r--src/mongo/dbtests/mock/mock_remote_db_server.cpp2
-rw-r--r--src/mongo/dbtests/mock_dbclient_conn_test.cpp12
3 files changed, 9 insertions, 9 deletions
diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
index 3975349ecb1..802391855ec 100644
--- a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
+++ b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
@@ -67,7 +67,7 @@ std::pair<rpc::UniqueReply, DBClientBase*> MockDBClientConnection::runCommandWit
try {
return {_remoteServer->runCommand(_remoteServerInstanceID, request), this};
- } catch (const mongo::SocketException&) {
+ } catch (const mongo::DBException&) {
_isFailed = true;
throw;
}
@@ -96,7 +96,7 @@ std::unique_ptr<mongo::DBClientCursor> MockDBClientConnection::query(const strin
std::unique_ptr<mongo::DBClientCursor> cursor;
cursor.reset(new MockDBClientCursor(this, result));
return cursor;
- } catch (const mongo::SocketException&) {
+ } catch (const mongo::DBException&) {
_isFailed = true;
throw;
}
diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.cpp b/src/mongo/dbtests/mock/mock_remote_db_server.cpp
index cf1380e99cb..0d09a1036c6 100644
--- a/src/mongo/dbtests/mock/mock_remote_db_server.cpp
+++ b/src/mongo/dbtests/mock/mock_remote_db_server.cpp
@@ -232,7 +232,7 @@ void MockRemoteDBServer::checkIfUp(InstanceID id) const {
scoped_spinlock sLock(_lock);
if (!_isRunning || id < _instanceID) {
- throw mongo::SocketException(mongo::SocketException::CLOSED, _hostAndPort);
+ throwSocketError(mongo::SocketErrorKind::CLOSED, _hostAndPort);
}
}
}
diff --git a/src/mongo/dbtests/mock_dbclient_conn_test.cpp b/src/mongo/dbtests/mock_dbclient_conn_test.cpp
index d347eb76897..9ae092e1518 100644
--- a/src/mongo/dbtests/mock_dbclient_conn_test.cpp
+++ b/src/mongo/dbtests/mock_dbclient_conn_test.cpp
@@ -535,14 +535,14 @@ TEST(MockDBClientConnTest, Shutdown) {
server.shutdown();
ASSERT(!server.isRunning());
- ASSERT_THROWS(conn.query("test.user"), mongo::SocketException);
+ ASSERT_THROWS(conn.query("test.user"), mongo::NetworkException);
}
{
MockDBClientConnection conn(&server);
BSONObj response;
ASSERT_THROWS(conn.runCommand("test.user", BSON("serverStatus" << 1), response),
- mongo::SocketException);
+ mongo::NetworkException);
}
ASSERT_EQUALS(0U, server.getQueryCount());
@@ -562,11 +562,11 @@ TEST(MockDBClientConnTest, Restart) {
conn1.runCommand("test.user", BSON("serverStatus" << 1), response);
server.shutdown();
- ASSERT_THROWS(conn1.query("test.user"), mongo::SocketException);
+ ASSERT_THROWS(conn1.query("test.user"), mongo::NetworkException);
// New connections shouldn't work either
MockDBClientConnection conn2(&server);
- ASSERT_THROWS(conn2.query("test.user"), mongo::SocketException);
+ ASSERT_THROWS(conn2.query("test.user"), mongo::NetworkException);
ASSERT_EQUALS(1U, server.getQueryCount());
ASSERT_EQUALS(1U, server.getCmdCount());
@@ -580,8 +580,8 @@ TEST(MockDBClientConnTest, Restart) {
}
// Old connections still shouldn't work
- ASSERT_THROWS(conn1.query("test.user"), mongo::SocketException);
- ASSERT_THROWS(conn2.query("test.user"), mongo::SocketException);
+ ASSERT_THROWS(conn1.query("test.user"), mongo::NetworkException);
+ ASSERT_THROWS(conn2.query("test.user"), mongo::NetworkException);
ASSERT_EQUALS(2U, server.getQueryCount());
ASSERT_EQUALS(1U, server.getCmdCount());