Last active
January 1, 2016 13:19
-
-
Save kjaquier/8150511 to your computer and use it in GitHub Desktop.
Informations d'exception
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
def current_exception_details(): | |
"""Retourne un tuple contenant les les informations sur l'exception | |
en cours de traitement | |
Retour : ( | |
Nom du fichier, | |
Ligne, | |
Nom de l'exception, | |
Type de l'exception, | |
Message de l'exception | |
) | |
""" | |
# http://docs.python.org/2/library/sys.html#sys.exc_info | |
return ( | |
sys.exc_info()[2].tb_frame.f_code.co_filename, | |
sys.exc_info()[2].tb_lineno, | |
sys.exc_info()[2].tb_frame.f_code.co_name, | |
sys.exc_info()[0].__name__, | |
sys.exc_info()[1].message | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment