-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 0.1.4
-
Component/s: None
-
None
Currently it is fairly complicated to check if a write succeeded or not.
We don't throw an exception on writeerror nor writeconcernerror - but we do on connection and other related errors.
Furthermore, the user has to check both Result->getWriteErrors() and Result->getWriteConcernError() to see if there was an error.
This doesn't make whole lot of sense :/
We should throw MongoDB\Driver\BulkWriteException on bulkWrite failure, which contains ->getWriteResult() which returns the original WriteResult object.
The WriteResult object then has ->getWriteErrors() and ->getWriteConcernError().
For execute[Insert|Update|Delete]() we unwrap the BulkWriteException and throw DuplicateKeyException, WriteConcernException or generic WriteException on failure.
- is related to
-
PHPC-440 Create common parent for write concern and write errors
- Closed