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

Create common parent for write concern and write errors

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 1.0.0-rc0
    • Affects Version/s: 1.0.0-beta1
    • Component/s: None
    • Labels:
      None

      Currently, WriteConcernException, which is used for "soft" write concern errors, extends WriteException, which is directly used for "hard" write errors. This makes users do something like the following if they with to ignore soft errors:

      try {
          ...
      } catch (WriteConcernException $e) {
          // do nothing
      } catch (WriteException $e) {
          // do something
      }
      

      Instead we should have:

      • class WriteConcernException extends WriteException
      • class WriteErrorException extends WriteException
      • abstract class WriteException extends RuntimeException

      Any place where we currently throw WriteException should be changed to WriteErrorException.

      Any classes that extend WriteException (e.g. DuplicateKeyException) should be changed to extend WriteErrorException.

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

              Created:
              Updated:
              Resolved: