Return 500 errors for command timeout

Bumper was returning an invalid errno when a command for MQTT would timeout.  Change to return a 500 errno with a debug message.

Closes #31
This commit is contained in:
Brian Martin 2019-05-21 10:13:21 -04:00
parent 38f31a8e69
commit 5bf202189d
2 changed files with 4 additions and 2 deletions

View file

@ -142,11 +142,13 @@ class MQTTHelperBot:
self.command_responses.set(cresp)
return resp
return {"id": requestid, "errno": "timeout", "ret": "fail"}
return {"id": requestid, "errno": 500, "ret": "fail", "debug": "wait for response timed out"}
except asyncio.CancelledError as e:
helperbotlog.debug("wait_for_resp cancelled by asyncio")
return {"id": requestid, "errno": 500, "ret": "fail", "debug": "wait for response timed out"}
except Exception as e:
helperbotlog.exception("{}".format(e))
return {"id": requestid, "errno": 500, "ret": "fail", "debug": "wait for response timed out"}
async def send_command(self, cmdjson, requestid):
try: