Skip to content

Commit bf6da6c

Browse files
authored
PHPLIB-636: ListIndexes should use CommandException for catching missing namespace and database errors (#837)
1 parent 94f7ce0 commit bf6da6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Operation/ListIndexes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
use EmptyIterator;
2121
use MongoDB\Driver\Command;
22+
use MongoDB\Driver\Exception\CommandException;
2223
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
2324
use MongoDB\Driver\Server;
2425
use MongoDB\Driver\Session;
@@ -135,7 +136,7 @@ private function executeCommand(Server $server)
135136

136137
try {
137138
$cursor = $server->executeReadCommand($this->databaseName, new Command($cmd), $this->createOptions());
138-
} catch (DriverRuntimeException $e) {
139+
} catch (CommandException $e) {
139140
/* The server may return an error if the collection does not exist.
140141
* Check for possible error codes (see: SERVER-20463) and return an
141142
* empty iterator instead of throwing.

0 commit comments

Comments
 (0)