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

Do not use BulkWriteException for client-side errors

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Original title: BulkWriteException's proxy behavior may violate contract for ServerException

      ServerException's documentation states:

      Base class for exceptions thrown by the server. The code of this exception and its subclasses will correspond to the original error code from the server.

      BulkWriteException extends ServerException through WriteException; however, not all BulkWriteExceptions are derived from server-side errors. Logic in phongo_execute_bulk_write ensures that a BulkWriteException is always thrown once mongoc_bulk_operation_execute() has been called to ensure that an intermediary write result is always accessible (see: PHPC-1373). If an error from mongoc_bulk_operation_execute happens to yield different exception, it will be thrown first and become accessible via BulkWriteException::getPrevious().

      This behavior is unintuitive and complicates logic in PHPLIB's test suite that checks whether an exception is a client-side error (since we must unwrap a BulkWriteException to determine the original exception).

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

              Created:
              Updated:
              Resolved: