-
Type: Task
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.5.2
-
Component/s: None
-
None
Prompted by Stack Overflow:
InvalidStringData includes a repr of the invalid string when raised by the Python BSON implementation, but not when raised by the C implementation.
>>> bad = {} >>> bad['zzz'] = '0\x82\x05\x17' >>> try: ... MongoClient().test.test.insert(bad) ... except bson.errors.InvalidStringData as isd: ... my_error = isd ... >>> my_error InvalidStringData('strings in documents must be valid UTF-8',)