Skip to content

Commit 6260899

Browse files
committed
Add $writeResult property to ConnectionTimeoutException
1 parent 18e2e15 commit 6260899

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

src/MongoDB/Exception/ConnectionTimeoutException.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,25 @@
1717
#include <php.h>
1818

1919
#include "php_phongo.h"
20+
#include "phongo_error.h"
2021
#include "ConnectionTimeoutException_arginfo.h"
2122

2223
zend_class_entry* php_phongo_connectiontimeoutexception_ce;
2324

25+
/* Returns the WriteResult from the failed write operation. */
26+
static PHP_METHOD(MongoDB_Driver_Exception_ConnectionTimeoutException, getWriteResult)
27+
{
28+
zval* writeresult;
29+
zval rv;
30+
31+
PHONGO_PARSE_PARAMETERS_NONE();
32+
33+
writeresult = zend_read_property(php_phongo_bulkwriteexception_ce, Z_OBJ_P(getThis()), ZEND_STRL("writeResult"), 0, &rv);
34+
35+
RETURN_ZVAL(writeresult, 1, 0);
36+
}
37+
38+
2439
void php_phongo_connectiontimeoutexception_init_ce(INIT_FUNC_ARGS)
2540
{
2641
php_phongo_connectiontimeoutexception_ce = register_class_MongoDB_Driver_Exception_ConnectionTimeoutException(php_phongo_connectionexception_ce);

src/MongoDB/Exception/ConnectionTimeoutException.stub.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@
99

1010
final class ConnectionTimeoutException extends ConnectionException
1111
{
12+
/** @var \MongoDB\Driver\WriteResult */
13+
protected $writeResult;
14+
15+
final public function getWriteResult(): \MongoDB\Driver\WriteResult {}
1216
}

src/MongoDB/Exception/ConnectionTimeoutException_arginfo.h

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)