util/ExceptionHandler.py
changeset 1953 5736d25bb393
parent 1941 cde74a39df51
child 3303 0ffb41625592
equal deleted inserted replaced
1952:0c20fc810d61 1953:5736d25bb393
    72     try:
    72     try:
    73         res = (dlg.ShowModal() == wx.ID_OK)
    73         res = (dlg.ShowModal() == wx.ID_OK)
    74     finally:
    74     finally:
    75         dlg.Destroy()
    75         dlg.Destroy()
    76 
    76 
    77     if exit : sys.exit() #wx.Exit()
    77     if exit:
       
    78         sys.exit()  # wx.Exit()
    78 
    79 
    79     return res
    80     return res
    80 
    81 
    81 
    82 
    82 def get_last_traceback(tb):
    83 def get_last_traceback(tb):
   125         lst.sort()
   126         lst.sort()
   126         for a in lst:
   127         for a in lst:
   127             output.write(a + ":\n" + str(info[a]) + "\n\n")
   128             output.write(a + ":\n" + str(info[a]) + "\n\n")
   128         output.close()
   129         output.close()
   129 
   130 
   130     def handle_exception(e_type, e_value, e_traceback, exit = False):
   131     def handle_exception(e_type, e_value, e_traceback, exit=False):
   131         traceback.print_exception(e_type, e_value, e_traceback)  # this is very helpful when there's an exception in the rest of this func
   132         traceback.print_exception(e_type, e_value, e_traceback)  # this is very helpful when there's an exception in the rest of this func
   132         last_tb = get_last_traceback(e_traceback)
   133         last_tb = get_last_traceback(e_traceback)
   133         ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
   134         ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
   134         if ex not in ignored_exceptions:
   135         if ex not in ignored_exceptions:
   135             ignored_exceptions.append(ex)
   136             ignored_exceptions.append(ex)