frappy.client: catch errors on callbacks

buggy updates or errors in callbacks are now converted into
error updates, buggy error updates are skipped.

-> the receive thread should no longer crash

Change-Id: I97e3999db73e64f73dfbc380fac3d7685b6ca31c
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/33386
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2024-03-26 15:21:47 +01:00
parent ac251ea515
commit dddf74df9e

View File

@ -416,6 +416,14 @@ class SecopClient(ProxyClient):
self.updateValue(module, param, value, timestamp, readerror)
except KeyError:
pass # ignore updates of unknown parameters
except Exception as e:
self.log.debug(f'error when updating %s:%s %r', module, param, value)
try:
# catch errors in callback functions
self.updateValue(module, param, None, timestamp,
type(e)(f'{e} - raised on client side'))
except Exception as ee:
self.log.warn(f'can not handle error update %r for %s:%s: %r', e, module, param, ee)
if action in (EVENTREPLY, ERRORPREFIX + EVENTREPLY):
continue
try: