forked from andrius/neohubapi
Neohub can return invalid JSON. Assume that command failed.
E.g. {"error":"Invalid argument to SET_TEMP_FORMAT, should be "C" or "F" "} Correct JSON would be {"error":"Invalid argument to SET_TEMP_FORMAT, should be \"C\" or \"F\" "}
This commit is contained in:
parent
175497b15b
commit
6973ec8d17
|
@ -33,7 +33,13 @@ class NeoHub:
|
||||||
writer.close()
|
writer.close()
|
||||||
await writer.wait_closed()
|
await writer.wait_closed()
|
||||||
|
|
||||||
reply = json.loads(json_string)
|
try:
|
||||||
|
reply = json.loads(json_string)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
if expected_reply is None:
|
||||||
|
raise(e)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
if expected_reply is None:
|
if expected_reply is None:
|
||||||
return reply
|
return reply
|
||||||
|
|
Loading…
Reference in New Issue