Handle unknown TPI response codes gracefully. (tornado)
Opened this issue · 2 comments
AlarmServer should handle unknown TPI codes gracefully.
Currently with the feature/tornado branch, an unknown code generates a KeyError and then AlarmServer is broken but still running.
See #46 for an explanation of the 616 code which was added to TPI 1.07.
Jul 01 09:48:04 - ERROR: Future exception was never retrieved: Traceback (most recent call last):
File "alarmserver/python/tornado-4.3-py2.6-linux-i686.egg/tornado/gen.py", line 282, in wrapper
yielded = next(result)
File "alarmserver/juggie/AlarmServer/core/envisalink.py", line 105, in handle_line
event = getMessageType(int(code))
File "alarmserver/juggie/AlarmServer/core/envisalink.py", line 17, in getMessageType
return evl_ResponseTypes[code]
KeyError: 616
With #49 (tornado) it will now log the unknown message and keep processing normally. Will add definition for the new zone bypass code, 616 shortly.
Reopening - This isn't working as intended.
I maybe misunderstanding things, but I'm guessing there is a structural problem with envisalink.py:handle_line(). All of the error handling in handle_line does a return which I think breaks things because that means the code never gets to the yield which causes the next read to occur.
Actually maybe this should be a separate/new issue.