Created
March 18, 2021 15:06
-
-
Save titovanton/3092aadeb7c216980e90aa300ea6916d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pdb | |
import traceback | |
class DebugOnError: | |
def __init__(self, suppress=False): | |
self.suppress = suppress | |
def __enter__(self): | |
return None | |
def __exit__(self, _type, _value, _traceback): | |
if _traceback: | |
traceback.print_exception(_type, _value, _traceback) | |
pdb.post_mortem(_traceback) | |
return self.suppress | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment