driver: fix bug in failing to emit error msg
This commit is contained in:
parent
753a16ab8e
commit
7dd551201e
@ -171,7 +171,7 @@ class FilterConfig:
|
||||
def _filter_type(self):
|
||||
return "Sinc3WithFineODR"
|
||||
|
||||
class InvalidCmd(Exception):
|
||||
class KirdyCmdError(Exception):
|
||||
pass
|
||||
|
||||
class Device:
|
||||
@ -890,15 +890,15 @@ class Kirdy:
|
||||
return json.loads(response[0])
|
||||
|
||||
def _response_handling(self, msg, msg_type, sig=None):
|
||||
if msg["msg_type"] in ["InvalidCmd", "InvalidDatatype"]:
|
||||
raise InvalidCmd
|
||||
elif msg["msg_type"] == msg_type:
|
||||
if msg["msg_type"] == msg_type:
|
||||
if sig is not None:
|
||||
sig.emit(msg)
|
||||
else:
|
||||
logging.warn(f"Commands fail to execute. {msg['msg_type']}:{msg['msg']}")
|
||||
if self._err_msg_sig is not None and msg['msg'] is not None:
|
||||
self._err_msg_sig.emit(msg['msg'])
|
||||
if self._err_msg_sig is not None:
|
||||
self._err_msg_sig.emit(f"{msg['msg_type']}:{str(msg['msg'])}")
|
||||
else:
|
||||
raise KirdyCmdError(f"{msg['msg_type']}:{str(msg['msg'])}")
|
||||
return msg
|
||||
|
||||
async def _send_cmd(self, target, cmd, data=None, msg_type="Acknowledge", sig=None):
|
||||
|
Loading…
Reference in New Issue
Block a user