log.exception instead of log.error in callbacks

+ inhibit timestamps in future

Change-Id: Idef463558bf24e891573179474ffbebd4e81468f
This commit is contained in:
zolliker 2023-05-25 16:16:30 +02:00
parent 1de5455ef6
commit 0cbaffd4b6

View File

@ -245,8 +245,10 @@ class ProxyClient:
except UnregisterCallback:
cblist.remove(cbfunc)
except Exception as e:
# the programmer should catch all errors in callbacks
# if not, the log will be flooded with errors
if self.log:
self.log.error('error %r calling %s%r', e, cbfunc.__name__, args)
self.log.exception('error %r calling %s%r', e, cbfunc.__name__, args)
return bool(cblist)
def updateValue(self, module, param, value, timestamp, readerror):
@ -398,6 +400,7 @@ class SecopClient(ProxyClient):
value = data[0]
readerror = None
module, param = module_param
timestamp = min(time.time(), timestamp) # no timestamps in the future!
try:
self.updateValue(module, param, value, timestamp, readerror)
except KeyError: