[GODRIVER-3005] Automatically add the full command error in error messages Created: 05/Oct/23  Updated: 31/Oct/23

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Preston Vasquez Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Quarter: FY24Q4
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Automatically include mongo.CommandError.Raw in the error message formatted by replaceErrors. For example, pymongo does the following:

>>> client.admin.command('not-a-command')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
...
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: no such command: 'not-a-command', full error: {'ok': 0.0, 'errmsg': "no such command: 'not-a-command'", 'code': 59, 'codeName': 'CommandNotFound', '$clusterTime': {'clusterTime': Timestamp(1696443940, 1), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}, 'operationTime': Timestamp(1696443940, 1)} 

Java also does this: https://github.com/mongodb/mongo-java-driver/blob/r4.0.2/driver-core/src/main/com/mongodb/MongoCommandException.java#L50-L51


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