Return 500 errors for command timeout #32

Merged
bmartin5692 merged 1 commit from fix-#31 into master 2019-05-21 16:25:20 +02:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit 5bf202189d - Show all commits

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: