Browse Source

print stacktrace before variable dump in case the process crashes while creating variable dump

Darren Ranalli 17 years ago
parent
commit
7583ac4861
1 changed files with 6 additions and 0 deletions
  1. 6 0
      direct/src/showbase/ExceptionVarDump.py

+ 6 - 0
direct/src/showbase/ExceptionVarDump.py

@@ -4,6 +4,7 @@ from direct.showbase.PythonUtil import fastRepr
 from exceptions import Exception
 import sys
 import types
+import traceback
 
 notify = directNotify.newCategory("ExceptionVarDump")
 
@@ -69,6 +70,11 @@ class _AttrNotFound:
     pass
 
 def _excepthookDumpVars(eType, eValue, tb):
+    excStrs = traceback.format_exception(eType, eValue, tb)
+    s = 'printing traceback in case variable repr crashes the process...\n'
+    for excStr in excStrs:
+        s += excStr
+    notify.info(s)
     s = 'DUMPING STACK FRAME VARIABLES'
     origTb = tb
     #import pdb;pdb.set_trace()