Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1044

Improve error handling and messages for unknown BSON types

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.9.2, 3.2.1
    • Affects Version/s: None
    • Component/s: None
    • None

      Currently the C extensions will raise bson.errors.InvalidDocument, which is later converted to bson.errors.InvalidBSON, with the message "no c decoder for this type yet" when encountering an unknown (or corrupt) type byte. The pure python decoder (in both PyMongo 2.x and 3.x) will raise KeyError due to a failed dict lookup.

      The pure python behavior is completely broken. It should raise InvalidBSON. The C version should also raise InvalidBSON directly, avoiding the later conversion. Both C and pure python should use the message defined in DRIVERS-281.

      Note that this is currently a minor bug that would only be a problem when decoding corrupt BSON. However, MongoDB 3.4 will introduce a few new BSON types not yet supported by PyMongo.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: