[JAVA-2843] Exceptions should include codeName string from server response Created: 27/Apr/18 Updated: 28/Oct/23 Resolved: 30/Apr/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Error Handling |
| Affects Version/s: | None |
| Fix Version/s: | 3.8.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
As of MongoDB 3.4, error responses from the server include not only the error code and message, but also a stringified representation of the error code, in the codeName field. Drivers should ensure that this code name is accessible from any errors that are returned or exceptions that are raised based on error responses from the server. Example responses: MongoDB Enterprise repl0:PRIMARY> db.runCommand( {insert: "test", documents: []}) { "operationTime" : Timestamp(1524837772, 1), "ok" : 0, "errmsg" : "Write batch sizes must be between 1 and 100000. Got 0 operations.", "code" : 16, "codeName" : "InvalidLength", }MongoDB Enterprise repl0:PRIMARY> db.runCommand({insert: "test", writeConcern: {w: 10}, documents: [{_id: 2}]}) , , } |
| Comments |
| Comment by Githook User [ 30/Apr/18 ] |
|
Author: {'email': 'jeff.yemin@10gen.com', 'username': 'jyemin', 'name': 'Jeff Yemin'}Message: The server introduced a codeName field in error responses, which is a This commit adds a codeName property to MongoCommandException and |
| Comment by Githook User [ 30/Apr/18 ] |
|
Author: {'email': 'jeff.yemin@10gen.com', 'username': 'jyemin', 'name': 'Jeff Yemin'}Message: |
| Comment by Githook User [ 30/Apr/18 ] |
|
Author: {'email': 'jeff.yemin@10gen.com', 'username': 'jyemin', 'name': 'Jeff Yemin'}Message: |
| Comment by Githook User [ 30/Apr/18 ] |
|
Author: {'email': 'jeff.yemin@10gen.com', 'username': 'jyemin', 'name': 'Jeff Yemin'}Message: |
| Comment by Githook User [ 30/Apr/18 ] |
|
Author: {'email': 'jeff.yemin@10gen.com', 'username': 'jyemin', 'name': 'Jeff Yemin'}Message: Move from com.mongodb.operation to com.mongodb.internal.operation and |
| Comment by Githook User [ 30/Apr/18 ] |
|
Author: {'email': 'jeff.yemin@10gen.com', 'username': 'jyemin', 'name': 'Jeff Yemin'}Message: Move from OperationHelper to ServerVersionHelper class in internal |
| Comment by Githook User [ 30/Apr/18 ] |
|
Author: {'email': 'jeff.yemin@10gen.com', 'username': 'jyemin', 'name': 'Jeff Yemin'}Message: Move from WriteConcernHelper to CommandOperationHelper to aid in a |