Details
-
Improvement
-
Resolution: Unresolved
-
Unknown
-
None
-
None
-
None
-
None
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