comparison sat_frontends/quick_frontend/quick_app.py @ 3077:ab8be8f1c92d

quick frontend(app): catch exception when trying to remove a missing listener, and log it
author Goffi <goffi@goffi.org>
date Mon, 18 Nov 2019 22:34:13 +0100
parents f8e3789912d0
children ab7e8ade848a
comparison
equal deleted inserted replaced
3076:2180b0f5c1cd 3077:ab8be8f1c92d
563 563
564 @param type_: same as for [addListener] 564 @param type_: same as for [addListener]
565 @param callback: callback to remove 565 @param callback: callback to remove
566 """ 566 """
567 assert type_ in C.LISTENERS 567 assert type_ in C.LISTENERS
568 self._listeners[type_].pop(callback) 568 try:
569 self._listeners[type_].pop(callback)
570 except KeyError:
571 log.error(
572 f"Trying to remove an inexisting listener (type = {type_}): {callback}")
569 573
570 def callListeners(self, type_, *args, **kwargs): 574 def callListeners(self, type_, *args, **kwargs):
571 """Call the methods which listen type_ event. If a profiles filter has 575 """Call the methods which listen type_ event. If a profiles filter has
572 been register with a listener and profile argument is not None, the 576 been register with a listener and profile argument is not None, the
573 listener will be called only if profile is in the profiles filter list. 577 listener will be called only if profile is in the profiles filter list.