Skip to content

Commit cff05bb

Browse files
committed
Empty responses...
Handling empty responses from Inara (not sure why but that's been going on for a while).
1 parent 3747a63 commit cff05bb

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

edr/edrserver.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,23 @@ def __process_inara_response(self, resp):
9494
EDR_LOG.log(u"No Inara response: resp={}".format(resp), "WARNING")
9595
return None
9696

97-
json_resp = json.loads(resp)
98-
if not json_resp.get("body", None):
99-
EDR_LOG.log(u"No Inara body: json_resp={}".format(json_resp), "WARNING")
97+
EDR_LOG.log(u"Processing Inara response: resp={}".format(resp), "DEBUG")
98+
99+
body = None
100+
try:
101+
json_resp = json.loads(resp)
102+
if not json_resp.get("body", None):
103+
EDR_LOG.log(u"No Inara body: json_resp={}".format(json_resp), "WARNING")
104+
return None
105+
body = json_resp["body"]
106+
except:
107+
EDR_LOG.log(u"Exception during extraction of Inara body: resp={}".format(resp), "WARNING")
108+
return None
109+
110+
if body is None:
111+
EDR_LOG.log(u"No Inara body: resp={}".format(resp), "WARNING")
100112
return None
101113

102-
body = json_resp["body"]
103114
EDR_LOG.log(u"Inara body={}".format(body), "DEBUG")
104115
try:
105116
if body["header"]["eventStatus"] == 400:

0 commit comments

Comments
 (0)