SingleFileEventHandler: Remove try/except blocks
authorGuido Trotter <ultrotter@google.com>
Fri, 21 May 2010 13:28:40 +0000 (14:28 +0100)
committerGuido Trotter <ultrotter@google.com>
Tue, 25 May 2010 10:16:57 +0000 (11:16 +0100)
Since now we use the SingleFileEventHandler together with an error
handling asyncore dispatcher, we don't need the internal try/except
anymore.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/asyncnotifier.py

index 286cd2f..e60c260 100644 (file)
@@ -133,14 +133,7 @@ class SingleFileEventHandler(pyinotify.ProcessEvent):
     # by the callback by calling "enable" again on us.
     logging.debug("Received 'ignored' inotify event for %s", event.path)
     self.watch_handle = None
-
-    try:
-      self.callback(False)
-    except: # pylint: disable-msg=W0702
-      # we need to catch any exception here, log it, but proceed, because even
-      # if we failed handling a single request, we still want our daemon to
-      # proceed.
-      logging.error("Unexpected exception", exc_info=True)
+    self.callback(False)
 
   # pylint: disable-msg=C0103
   # this overrides a method in pyinotify.ProcessEvent
@@ -150,14 +143,7 @@ class SingleFileEventHandler(pyinotify.ProcessEvent):
     # replacing any file with a new one, at filesystem level, rather than
     # actually changing it. (see utils.WriteFile)
     logging.debug("Received 'modify' inotify event for %s", event.path)
-
-    try:
-      self.callback(True)
-    except: # pylint: disable-msg=W0702
-      # we need to catch any exception here, log it, but proceed, because even
-      # if we failed handling a single request, we still want our daemon to
-      # proceed.
-      logging.error("Unexpected exception", exc_info=True)
+    self.callback(True)
 
   def process_default(self, event):
     logging.error("Received unhandled inotify event: %s", event)