Commits

Ali Gholami Rudi  committed e6f2cf3

Printing exception traceback if an exception occurs

  • Participants
  • Parent commits f1ca483

Comments (0)

Files changed (1)

File ropemacs/lisputils.py

+import sys
+import traceback
 import threading
 
 from Pymacs import lisp
                 self.task = task
                 self.result = None
                 self.exception = None
+                self.traceback = None
 
             def __call__(self):
                 try:
                     self.result = self.task(handle)
                 except Exception, e:
                     self.exception = e
+                    self.traceback = str(traceback.format_exc())
 
         calculate = Calculate(self.task)
         thread = threading.Thread(target=calculate)
             if raised is not None:
                 description = type(raised).__name__ + ': ' + str(raised)
                 raise exceptions.InterruptedTaskError(
-                    'Task <%s> was interrupted.\nReason: <%s>' %
-                    (self.name, description))
+                    'Task <%s> was interrupted.\nReason: <%s>\nTraceback: %s' %
+                    (self.name, description, calculate.traceback))
         except:
             handle.stop()
             message('%s interrupted!' % self.name)