Ticket #1742: 0001-Stop-an-exception-in-an-Event-handler-from-preventin.patch

File 0001-Stop-an-exception-in-an-Event-handler-from-preventin.patch, 1.0 KB (added by jumentous, 10 years ago)
  • deluge/core/eventmanager.py

    From b7eb32a73cb171da444bdff0aea27a9f6dcd3bca Mon Sep 17 00:00:00 2001
    From: Jamie Lennox <jamielennox@gmail.com>
    Date: Sat, 16 Apr 2011 15:39:40 +1000
    Subject: [PATCH] Stop an exception in an Event handler from preventing further emissions
    
    ---
     deluge/core/eventmanager.py |    5 ++++-
     1 files changed, 4 insertions(+), 1 deletions(-)
    
    diff --git a/deluge/core/eventmanager.py b/deluge/core/eventmanager.py
    index 1985070..a1b6342 100644
    a b def emit(self, event): 
    5555        if event.name in self.handlers: 
    5656            for handler in self.handlers[event.name]: 
    5757                #log.debug("Running handler %s for event %s with args: %s", event.name, handler, event.args) 
    58                 handler(*event.args) 
     58                try: 
     59                    handler(*event.args) 
     60                except: 
     61                    log.exception("Event handler %s failed in %s", event.name, handler) 
    5962 
    6063    def register_event_handler(self, event, handler): 
    6164        """