Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1386

BulkWriteException and ExecutionTimeoutException do not expose codeName for server errors

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      DRIVERS-478 was previously validated for PHP without creating a ticket, but I believe that was premature as it was based purely on an example using CommandException.

      CDRIVER-3147 notes that libmongoc does not expose the servers codeName field on the result document for write operations. In PHP, this means the field is only accessible via CommandException::getResultDocument(), which means BulkWriteException and ExecutionTimeoutException are excluded.

      This came up while testing the transaction spec test for "abort ignores TransactionAborted" test from abort.json (PHPLIB-365). In that test, the raw response from mongoc_bulk_operation_execute is:

      { "nInserted" : 0, "nMatched" : 0, "nModified" : 0, "nRemoved" : 0, "nUpserted" : 0, "writeErrors" : [  ], "errorLabels" : [ "TransientTransactionError" ] }
      

      The error message and code are relayed via the bson_error_t struct; however, codeName is entirely absent. This demonstrates that a fix would require both CDRIVER-3147 and a corresponding change in PHPC.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: