Merged pull request #919

This commit is contained in:
Derick Rethans
2018-08-30 11:59:10 +01:00
2 changed files with 24 additions and 0 deletions

View File

@@ -166,6 +166,10 @@ zend_class_entry* phongo_exception_from_mongoc_domain(uint32_t /* mongoc_error_d
return php_phongo_serverexception_ce;
}
if (domain == MONGOC_ERROR_PROTOCOL && code == MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION) {
return php_phongo_connectionexception_ce;
}
return php_phongo_runtimeexception_ce;
}
void phongo_throw_exception(php_phongo_error_domain_t domain TSRMLS_DC, const char* format, ...)

View File

@@ -0,0 +1,20 @@
--TEST--
MongoDB\Driver\Manager::__construct(): wire version support
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new \MongoDB\Driver\Manager(URI);
$command = new MongoDB\Driver\Command(['ping' => 1]);
try {
$manager->executeCommand("test", $command);
} catch (\MongoDB\Driver\Exception\ConnectionException $e) {
if ($e->getCode() == 15) { // Bad Wire Version
echo "Bad wire version detected: ", $e->getMessage(), "\n";
}
}
?>
===DONE===
--EXPECT--
===DONE===