Documentation of DuplicateKeyException should be clarified

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.3.0
    • Affects Version/s: 4.1.1
    • Component/s: Documentation
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The documentation of `DuplicateKeyException` states:

      > Subclass of WriteConcernException representing a duplicate key exception

      And `WriteConcernException` in turn:

      > An exception representing an error reported due to a write failure.

      This is confusing. From the documentation one has to assume that `DuplicateKeyException` is thrown in case a duplicate key is encountered during a write operation.
      What's actually thrown is a `MongoCommandException` with `ErrorCategory.fromErrorCode(e.code) == ErrorCategory.DUPLICATE_KEY`.

      The documentation of `DuplicateKeyException` should be amended to clarify that it's not actually used (in certain situations) in this case counter to what the developer may expect or assume.

              Assignee:
              Jeffrey Yemin
              Reporter:
              Marc Knaup
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: