[migration/pdb] display traceback instead of only the exception for easier debugging
authorLaurent Peuch <cortex@worlddomination.be>
Thu, 23 May 2019 00:33:04 +0200
changeset 12746 5c432a7fc442
parent 12745 cc681b6fcffa
child 12749 ff63319a1730
[migration/pdb] display traceback instead of only the exception for easier debugging Closes #17219820
cubicweb/server/migractions.py
--- a/cubicweb/server/migractions.py	Wed May 22 17:10:06 2019 +0200
+++ b/cubicweb/server/migractions.py	Thu May 23 00:33:04 2019 +0200
@@ -32,6 +32,7 @@
 import tarfile
 import tempfile
 import shutil
+import traceback
 import os.path as osp
 from datetime import datetime
 from glob import glob
@@ -1456,8 +1457,8 @@
                 cu = self.cnx.system_sql(sql, args)
             except Exception:
                 _, ex, traceback_ = sys.exc_info()
-                if self.confirm('Error: %s\nabort?' % ex,
-                                pdb=True, traceback=traceback_):
+                traceback.print_exc()
+                if self.confirm('abort?', pdb=True, traceback=traceback_):
                     raise
                 return
             try:
@@ -1483,8 +1484,8 @@
                     res = execute(rql, kwargs, build_descr=build_descr)
                 except Exception:
                     _, ex, traceback_ = sys.exc_info()
-                    if self.confirm('Error: %s\nabort?' % ex,
-                                    pdb=True, traceback=traceback_):
+                    traceback.print_exc()
+                    if self.confirm('abort?', pdb=True, traceback=traceback_):
                         raise
         return res
 
@@ -1574,8 +1575,8 @@
             return self._h._cw.execute(rql, kwargs)
         except Exception:
             _, ex, traceback_ = sys.exc_info()
-            if self._h.confirm('Error: %s\nabort?' % ex,
-                               pdb=True, traceback=traceback_):
+            traceback.print_exc()
+            if self._h.confirm('abort?', pdb=True, traceback=traceback_):
                 raise
             else:
                 raise StopIteration