[SCM] morituri/master: * morituri/common/task.py: More exception handling and debug.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:27 UTC 2014


The following commit has been merged in the master branch:
commit b540b10c331c592714406d6d59b0cda5cdf9e031
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Tue May 24 13:21:51 2011 +0000

    	* morituri/common/task.py:
    	  More exception handling and debug.

diff --git a/ChangeLog b/ChangeLog
index 98ecad6..b9fb218 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2011-05-24  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/common/task.py:
+	  More exception handling and debug.
+
+2011-05-24  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/common/task.py:
 	  add task argument to TaskRunner.schedule so we can get exceptions.
 	  Add .schedule method to Task to pass self.
 	* morituri/common/checksum.py:
@@ -12,6 +17,14 @@
 
 2011-05-24  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	reviewed by: <delete if not using a buddy>
+	patch by: <delete if not someone else's patch>
+
+	* morituri/common/gstreamer.py:
+	* morituri/image/image.py:
+
+2011-05-24  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri/test/test_common_encode.py:
 	  Write a non-sine wave so we have an actual flac file that will
 	  typefind.
diff --git a/morituri/common/task.py b/morituri/common/task.py
index 8dd68d8..658eb34 100644
--- a/morituri/common/task.py
+++ b/morituri/common/task.py
@@ -173,7 +173,11 @@ class Task(object, log.Loggable):
     def _notifyListeners(self, methodName, *args, **kwargs):
         if self._listeners:
             for l in self._listeners:
-                getattr(l, methodName)(self, *args, **kwargs)
+                method = getattr(l, methodName)
+                try:
+                    method(self, *args, **kwargs)
+                except Exception, e:
+                    self.setException(e)
 
 # FIXME: should this become a real interface, like in zope ?
 class ITaskListener(object):
@@ -298,7 +302,8 @@ class BaseMultiTask(Task, ITaskListener):
         Subclasses should chain up to me at the end of their implementation.
         They should fall through to chaining up if there is an exception.
         """
-        self.log('BaseMultiTask.stopped: task %r', task)
+        self.log('BaseMultiTask.stopped: task %r (%d of %d)',
+            task, self.tasks.index(task) + 1, len(self.tasks))
         if task.exception:
             self.log('BaseMultiTask.stopped: exception %r',
                 task.exceptionMessage)
@@ -446,6 +451,7 @@ class SyncRunner(TaskRunner, ITaskListener):
                 self.debug('exception when calling scheduled callable %r',
                     callable)
                 task.setException(e)
+                self.stopped(task)
                 raise
         gobject.timeout_add(int(delta * 1000L), c)
 

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list