Skip to content

Commit

Permalink
Swallow message errors and continue.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcr3dr authored and peterbarker committed Mar 1, 2016
1 parent e836c57 commit 6c4fe4c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions dronekit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,9 +1464,21 @@ def remove_message_listener(self, name, fn):

def notify_message_listeners(self, name, msg):
for fn in self._message_listeners.get(name, []):
fn(self, name, msg)
try:
fn(self, name, msg)
except Exception as e:
errprinter('>>> Exception in message handler for %s' %
msg.get_type())
errprinter('>>> ' + str(e))

for fn in self._message_listeners.get('*', []):
fn(self, name, msg)
try:
fn(self, name, msg)
except Exception as e:
errprinter('>>> Exception in message handler for %s' %
msg.get_type())
errprinter('>>> ' + str(e))


def close(self):
return self._handler.close()
Expand Down

0 comments on commit 6c4fe4c

Please sign in to comment.