File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88import sys
99import faulthandler
10+ import traceback
1011import pdb
1112import json
1213import pyfiglet
@@ -130,7 +131,23 @@ def __init__(
130131 if debug :
131132 def handle_exception (exc_type , exc_value , exc_traceback ):
132133 if not issubclass (exc_type , KeyboardInterrupt ):
134+ def p (message : str ) -> None :
135+ "print error, in red if possible"
136+ try :
137+ red (message )
138+ except Exception as err :
139+ print (message )
140+ p (exc_type )
141+ p (exc_value )
142+ [p (line ) for line in traceback .format_tb (exc_traceback )]
143+ p ("\n --verbose was used so opening debug console at the "
144+ "appropriate frame. Press 'c' to continue to the frame "
145+ "of this print." )
133146 pdb .post_mortem (exc_traceback )
147+ p ("You are now in the exception handling frame." )
148+ breakpoint ()
149+ sys .exit (1 )
150+
134151 sys .excepthook = handle_exception
135152 faulthandler .enable ()
136153
You can’t perform that action at this time.
0 commit comments