mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-01 13:52:11 +02:00
Merged pull request #919
This commit is contained in:
@@ -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, ...)
|
||||
|
||||
20
tests/manager/manager-ctor-wireversion.phpt
Normal file
20
tests/manager/manager-ctor-wireversion.phpt
Normal 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===
|
||||
Reference in New Issue
Block a user