[SCM] morituri/master: * morituri/common/task.py: Add exceptionMessage on Task to store the result of log.getExceptionMessage when the stack is still valid.

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


The following commit has been merged in the master branch:
commit 757c3aba158dcb3321d7c99b3c76266cc89e079b
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Fri Oct 16 21:39:19 2009 +0000

    	* morituri/common/task.py:
    	  Add exceptionMessage on Task to store the result of
    	  log.getExceptionMessage when the stack is still valid.

diff --git a/ChangeLog b/ChangeLog
index 3e8c423..f0c03c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-16  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/common/task.py:
+	  Add exceptionMessage on Task to store the result of
+	  log.getExceptionMessage when the stack is still valid.
+
 2009-09-26  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* configure.ac:
diff --git a/morituri/common/task.py b/morituri/common/task.py
index a4d9dbc..1541830 100644
--- a/morituri/common/task.py
+++ b/morituri/common/task.py
@@ -47,6 +47,7 @@ class Task(object, log.Loggable):
     running = False
     runner = None
     exception = None
+    exceptionMessage = None
 
     _listeners = None
 
@@ -213,9 +214,10 @@ class BaseMultiTask(Task, ITaskListener):
             task.addListener(self)
             task.start(self.runner)
         except Exception, e:
-            self.debug('Got exception during next: %r',
-                log.getExceptionMessage(e))
+            m = log.getExceptionMessage(e)
+            self.debug('Got exception during next: %r', m)
             self.exception = e
+            self.exceptionMessage = m
             self.stop()
             return
         
@@ -345,8 +347,7 @@ class SyncRunner(TaskRunner, ITaskListener):
         self.debug('done running task %r', task)
         if task.exception:
             # FIXME: this gave a traceback in the logging module
-            self.debug('raising exception, %r',
-                log.getExceptionMessage(task.exception))
+            self.debug('raising exception, %r', task.exceptionMessage)
             raise task.exception
 
     def _startWrap(self, task):
@@ -355,9 +356,12 @@ class SyncRunner(TaskRunner, ITaskListener):
         try:
             task.start(self)
         except Exception, e:
-            self.debug('exception during start: %r',
-                log.getExceptionMessage(e))
+            # getExceptionMessage uses global exception state that doesn't
+            # hang around, so store the message
+            m = log.getExceptionMessage(e)
+            self.debug('exception during start: %r', m)
             task.exception = e
+            task.exceptionMessage = m
             self.stopped(task)
 
 

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list