Skip to content

Commit 1c4caa2

Browse files
committed
Merge pull request #231
2 parents b7d99e7 + 016eaf8 commit 1c4caa2

5 files changed

+17
-16
lines changed

php_phongo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ zend_class_entry* phongo_exception_from_mongoc_domain(uint32_t /* mongoc_error_d
121121
case 50: /* ExceededTimeLimit */
122122
return php_phongo_executiontimeoutexception_ce;
123123
case MONGOC_ERROR_STREAM_SOCKET:
124+
case MONGOC_ERROR_SERVER_SELECTION_FAILURE:
124125
return php_phongo_connectiontimeoutexception_ce;
125126
case MONGOC_ERROR_CLIENT_AUTHENTICATE:
126127
return php_phongo_authenticationexception_ce;

tests/manager/manager-executeBulkWrite_error-007.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ $manager = new MongoDB\Driver\Manager('mongodb://invalid.host:27017', ['serverSe
1414

1515
echo throws(function() use ($manager, $bulk) {
1616
$manager->executeBulkWrite(NS, $bulk);
17-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
17+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
1818

1919
// Valid host refuses connection
2020
$manager = new MongoDB\Driver\Manager('mongodb://localhost:54321', ['serverSelectionTimeoutMS' => 1]);
2121

2222
echo throws(function() use ($manager, $bulk) {
2323
$manager->executeBulkWrite(NS, $bulk);
24-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
24+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
2525

2626
?>
2727
===DONE===
2828
<?php exit(0); ?>
2929
--EXPECTF--
30-
OK: Got MongoDB\Driver\Exception\RuntimeException
30+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3131
No suitable servers found (`serverselectiontryonce` set): %s
32-
OK: Got MongoDB\Driver\Exception\RuntimeException
32+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3333
No suitable servers found (`serverselectiontryonce` set): %s
3434
===DONE===

tests/manager/manager-executeCommand_error-001.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ $manager = new MongoDB\Driver\Manager('mongodb://invalid.host:27017', ['serverSe
1313

1414
echo throws(function() use ($manager, $command) {
1515
$manager->executeCommand(DATABASE_NAME, $command);
16-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
16+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
1717

1818
// Valid host refuses connection
1919
$manager = new MongoDB\Driver\Manager('mongodb://localhost:54321', ['serverSelectionTimeoutMS' => 1]);
2020

2121
echo throws(function() use ($manager, $command) {
2222
$manager->executeCommand(DATABASE_NAME, $command);
23-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
23+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
2424

2525
?>
2626
===DONE===
2727
<?php exit(0); ?>
2828
--EXPECTF--
29-
OK: Got MongoDB\Driver\Exception\RuntimeException
29+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3030
No suitable servers found (`serverselectiontryonce` set): %s
31-
OK: Got MongoDB\Driver\Exception\RuntimeException
31+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3232
No suitable servers found (`serverselectiontryonce` set): %s
3333
===DONE===

tests/manager/manager-executeQuery_error-001.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ $manager = new MongoDB\Driver\Manager('mongodb://invalid.host:27017', ['serverSe
1313

1414
echo throws(function() use ($manager, $query) {
1515
$manager->executeQuery(NS, $query);
16-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
16+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
1717

1818
// Valid host refuses connection
1919
$manager = new MongoDB\Driver\Manager('mongodb://localhost:54321', ['serverSelectionTimeoutMS' => 1]);
2020

2121
echo throws(function() use ($manager, $query) {
2222
$manager->executeQuery(NS, $query);
23-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
23+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
2424

2525
?>
2626
===DONE===
2727
<?php exit(0); ?>
2828
--EXPECTF--
29-
OK: Got MongoDB\Driver\Exception\RuntimeException
29+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3030
No suitable servers found (`serverselectiontryonce` set): %s
31-
OK: Got MongoDB\Driver\Exception\RuntimeException
31+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3232
No suitable servers found (`serverselectiontryonce` set): %s
3333
===DONE===

tests/manager/manager-selectserver_error-001.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ $manager = new MongoDB\Driver\Manager('mongodb://invalid.host:27017', ['serverSe
1313

1414
echo throws(function() use ($manager, $rp) {
1515
$manager->selectServer($rp);
16-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
16+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
1717

1818
// Valid host refuses connection
1919
$manager = new MongoDB\Driver\Manager('mongodb://localhost:54321', ['serverSelectionTimeoutMS' => 1]);
2020

2121
echo throws(function() use ($manager, $rp) {
2222
$manager->selectServer($rp);
23-
}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
23+
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException'), "\n";
2424

2525
?>
2626
===DONE===
2727
<?php exit(0); ?>
2828
--EXPECTF--
29-
OK: Got MongoDB\Driver\Exception\RuntimeException
29+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3030
No suitable servers found (`serverselectiontryonce` set): %s
31-
OK: Got MongoDB\Driver\Exception\RuntimeException
31+
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
3232
No suitable servers found (`serverselectiontryonce` set): %s
3333
===DONE===

0 commit comments

Comments
 (0)