Wed, 02 Feb 2022 11:46:05 +0200
Workaround to refresh timer loops on some configurations
# # Borgend by Tuomo Valkonen, 2018 # # Except-catching decocators to catch bugs in callbacks # import logging logger=logging.getLogger(__name__) def protect_noreturn(fn): name=fn.__name__ def wrapper(*args, **kwargs): try: fn(*args, **kwargs) except: logger.exception('bug in ' + name) return wrapper def protect_return(default): def wrap(fn): name=fn.__name__ def wrapper(*args, **kwargs): try: return fn(*args, **kwargs) except: logger.exception('bug in ' + name) return default return wrapper return wrap