Skip to content

Commit b39cda3

Browse files
committed
Handle command responses without "ok" field. PYTHON-574
1 parent 336fb94 commit b39cda3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pymongo/helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ def _unpack_response(response, cursor_id=None, as_class=dict,
116116
def _check_command_response(response, reset, msg="%s", allowable_errors=[]):
117117
"""Check the response to a command for errors.
118118
"""
119+
if "ok" not in response:
120+
# Server didn't recognize our message as a command.
121+
raise OperationFailure(response.get("$err"))
122+
119123
if not response["ok"]:
120124
if "wtimeout" in response and response["wtimeout"]:
121125
raise TimeoutError(msg % response["errmsg"])

0 commit comments

Comments
 (0)