[JAVA-1352] DuplicateKeyException should provide the propertyname which is duplicated Created: 06/Aug/14 Updated: 12/Aug/14 Resolved: 12/Aug/14 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API, Error Handling, Write Operations |
| Affects Version/s: | 2.12.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Dominic Sachs [X] | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 8 |
||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
It would be nice if a DuplicateKeyException is thrown and the duplicated property is returned by the exception object. |
| Comments |
| Comment by Jeffrey Yemin [ 12/Aug/14 ] | |||||||
|
I opened Regards, | |||||||
| Comment by Jeffrey Yemin [ 06/Aug/14 ] | |||||||
|
Also, note that in general this could be the result of a unique key violation of a compound index, so there may be more than one property name, e.g.:
A duplicate key error on that index reports this errmsg:
| |||||||
| Comment by Ross Lawley [ 06/Aug/14 ] | |||||||
|
Currently, that information is not returned by the server - just the string error message containing the index name and the duplicated key. I think the best course of action would be to add a SERVER ticket to get this information included. Regards, Ross | |||||||
| Comment by Dominic Sachs [X] [ 06/Aug/14 ] | |||||||
|
Hi Ross, thanks. I have to parse the String, to get the property name? I'm looking for the raw property name. | |||||||
| Comment by Ross Lawley [ 06/Aug/14 ] | |||||||
|
Hi Noodles, You can get the error message back from the server which describes the duplicated key by looking in the commandResult of the insert. For example:
|