diff --git a/dronekit/__init__.py b/dronekit/__init__.py index 03f1e8c41..ff169b5c5 100644 --- a/dronekit/__init__.py +++ b/dronekit/__init__.py @@ -629,9 +629,20 @@ def notify_attribute_listeners(self, attr_name, value, cache=False): # Notify observers. for fn in self._attribute_listeners.get(attr_name, []): - fn(self, attr_name, value) + try: + fn(self, attr_name, value) + except Exception as e: + errprinter('>>> Exception in attribute handler for %s' % + attr_name) + errprinter('>>> ' + str(e)) + for fn in self._attribute_listeners.get('*', []): - fn(self, attr_name, value) + try: + fn(self, attr_name, value) + except Exception as e: + errprinter('>>> Exception in attribute handler for %s' % + attr_name) + errprinter('>>> ' + str(e)) def on_attribute(self, name): """