Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3005

Automatically add the full command error in error messages

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • None
    • None
    • Hide

      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?

      Show
      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            preston.vasquez@mongodb.com Preston Vasquez
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: