-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
BulkWriteException has historically used zero as its integer code. With libmongoc error API v2, mongoc_bulk_operation_execute() now reports its errors in the MONGOC_ERROR_SERVER and MONGOC_ERROR_WRITE_CONCERN domains (see: Error Reporting).
With the introduction of ServerException in PHPC-1087, we now document that codes used for that exception and its sub-classes originate from the server. Since WriteException and BulkWriteException are children of that class, we should also use the error code from libmongoc's bson_errot_t instead of zero.
As I mentioned in mongodb/mongo-php-driver#781, we can accomplish this by using zend_throw_exception directly.