PYTHON-766 Fix KeyError when parsing certain mongos error responses.
This commit is contained in:
parent
90098d3844
commit
2e74187e19
@ -143,8 +143,8 @@ def _check_command_response(response, reset, msg=None, allowable_errors=None):
|
||||
# for some errors.
|
||||
if "raw" in response:
|
||||
for shard in response["raw"].itervalues():
|
||||
if not shard.get("ok"):
|
||||
# Just grab the first error...
|
||||
# Grab the first non-empty raw error from a shard.
|
||||
if shard.get("errmsg") and not shard.get("ok"):
|
||||
details = shard
|
||||
break
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user