Merge pull request #32 from bmartin5692/fix-#31

Return 500 errors for command timeout
This commit is contained in:
Brian Martin 2019-05-21 10:25:19 -04:00 committed by GitHub
commit 4af69d87fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -1164,7 +1164,7 @@ class ConfServer:
json_body["toId"] json_body["toId"]
) )
) )
body = {"id": randomid, "errno": bumper.ERR_COMMON, "ret": "fail"} body = {"id": randomid, "errno": 500, "ret": "fail", "debug": "wait for response timed out"}
return web.json_response(body) return web.json_response(body)
else: else:

View file

@ -142,11 +142,13 @@ class MQTTHelperBot:
self.command_responses.set(cresp) self.command_responses.set(cresp)
return resp 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: except asyncio.CancelledError as e:
helperbotlog.debug("wait_for_resp cancelled by asyncio") 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: except Exception as e:
helperbotlog.exception("{}".format(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): async def send_command(self, cmdjson, requestid):
try: try: