[JAVA-1903] BulkWriteException message should print BulkWriteError details Created: 23/Jul/15  Updated: 28/Sep/16  Resolved: 28/Sep/16

Status: Closed
Project: Java Driver
Component/s: Error Handling
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Luke Lovett Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-2267 Fix BulkWriteException's message Closed
Related

 Description   

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.



 Comments   
Comment by Jeffrey Yemin [ 28/Sep/16 ]

Closing as duplicate of JAVA-2267.

Generated at Thu Feb 08 08:55:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.