Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1903

BulkWriteException message should print BulkWriteError details

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Error Handling
    • Labels:
      None

      I'm filing this on behalf of HADOOP-214.

      The message for a BulkWriteException includes a list of addresses of BulkWriteErrors. This ticket suggests that the message should instead include the BulkWriteError message instead of the object's address, i.e.

      com.mongodb.BulkWriteException: Bulk write operation error on server localhost:27017. Write errors: [com.mongodb.BulkWriteError@4056e6bc]
      

      could become

      com.mongodb.BulkWriteException: Bulk write operation error on server localhost:27017. Write errors: [BulkWriteError{index=0, code=11000, message='E11000 duplicate key error index: tagcloud.entitonstmp.$_id_ dup key: { : "duplicated_id" }', details={ }}]
      

      I can also see how this might be intentional; if the BulkWriteException has 1000 BulkWriteErrors, then printing the message for all of them would be overly verbose. However, you could also print the first 3 (or some other number) messages and just note that there are 997 more BulkWriteErrors.

            Assignee:
            Unassigned Unassigned
            Reporter:
            luke.lovett Luke Lovett
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: