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

Throw InvalidArgumentException if BulkWrite is executed multiple times

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      In 6dc41c4 for PHPC-676, we started throwing a BulkWriteException if a BulkWrite object was executed multiple times. The exception's code was zero (per phongo_throw_exception()) and it did not include a write result object.

      As of PHPC-1087 and PHPC-1144, we would like to document that all ServerExceptions (including BulkWriteException) include a code that originates from the server. I propose we instead throw an InvalidArgumentException for the case of PHPC-676. While this represents a behavioral change, I wouldn't consider it a BC-breaking change since InvalidArugmentException is already a possible exception for executeBulkWrite(). Additionally, we never documented that we throw an exception for executing a BulkWrite object multiple times.

      With this change, I reckon we can also delete the PHONGO_ERROR_WRITE_FAILED constant.

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: