Author: remi
Date: 2008-12-14 12:42:51 +0100 (Sun, 14 Dec 2008)
New Revision: 3107

Modified:
   
software_suite_v2/tuxware/pytuxisalive/branches/complete_refactoring/src/tuxisalive/api/TuxEventHandler.py
Log:
* show the traceback on error in a callback

Modified: 
software_suite_v2/tuxware/pytuxisalive/branches/complete_refactoring/src/tuxisalive/api/TuxEventHandler.py
===================================================================
--- 
software_suite_v2/tuxware/pytuxisalive/branches/complete_refactoring/src/tuxisalive/api/TuxEventHandler.py
  2008-12-14 11:41:43 UTC (rev 3106)
+++ 
software_suite_v2/tuxware/pytuxisalive/branches/complete_refactoring/src/tuxisalive/api/TuxEventHandler.py
  2008-12-14 11:42:51 UTC (rev 3107)
@@ -17,6 +17,8 @@
 import threading
 import time
 import copy
+import traceback
+import sys
 
 class TuxEventHandler(object):
     """TuxEventHandler is an event controller which give to you the mechanisms 
to
@@ -130,12 +132,24 @@
         self.__functStructList = []
         self.__listMutex.release()
         
+    def __formatException(self):
+        """Format the traceback.
+        """
+        fList = traceback.format_exception(sys.exc_info()[0],
+                    sys.exc_info()[1],
+                    sys.exc_info()[2])
+        result = ""
+        for line in fList:
+            result += line
+        return result
+        
     def __run(self, functPtr, idx, fArgs):
         """Run a callback method.
         """
         try:
             functPtr(*fArgs)
         except:
+            print self.__formatException()
             self.unregister(idx)
             
     def emit(self, *fArgs):


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to