def display_and_log(*exc_info): # Slot-not-ready errors in the render thread are logged, but not shown to the user. if "TileProvider" in threading.current_thread().name: from lazyflow.graph import Slot if isinstance(exc_info[1], Slot.SlotNotReadyError): logger.warn( "Caught unhandled SlotNotReadyError exception in the volumina tile rendering thread:" ) sio = StringIO.StringIO() traceback.print_exception( exc_info[0], exc_info[1], exc_info[2], file=sio ) logger.error( sio.getvalue() ) return # All other exceptions are treated as true errors logger.error( "".join( traceback.format_exception( *exc_info ) ) ) try: from ilastik.shell.gui.startShellGui import shell msg = str(exc_info[1]) msg += "\n\n (Advanced information about this error may be found in the log file: {})\n"\ "".format( LOGFILE_PATH ) shell.postErrorMessage( exc_info[0].__name__, msg ) except: logger.error( "UNHANDLED EXCEPTION WHILE DISPLAYING AN ERROR TO THE USER:" ) sio = StringIO.StringIO() traceback.print_exception( exc_info[0], exc_info[1], exc_info[2], file=sio ) logger.error( sio.getvalue() ) raise
def exception_dialog(*exc_info): old_excepthook(*exc_info) try: from ilastik.shell.gui.startShellGui import shell shell.postErrorMessage( exc_info[0].__name__, str(exc_info[1]) ) except: pass
def exception_dialog(*args): old_excepthook(*args) try: from ilastik.shell.gui.startShellGui import shell shell.postErrorMessage(args[0].__name__, args[1].message) except: pass
def display_and_log(*exc_info): # Slot-not-ready errors in the render thread are logged, but not shown to the user. from volumina.pixelpipeline.asyncabcs import IndeterminateRequestError if isinstance(exc_info[1], IndeterminateRequestError): logger.warning( "Caught unhandled IndeterminateRequestError from volumina." ) sio = io.StringIO() traceback.print_exception( exc_info[0], exc_info[1], exc_info[2], file=sio ) logger.warning( sio.getvalue() ) return # All other exceptions are treated as true errors _log_exception( *exc_info ) try: from ilastik.shell.gui.startShellGui import shell msg = str(exc_info[1]) + "\n" logfile_path = get_logfile_path() if logfile_path: msg += "\n (Advanced information about this error may be found in the log file: {})\n"\ "".format( logfile_path ) if shell: shell.postErrorMessage( exc_info[0].__name__, msg ) except: logger.error( "UNHANDLED EXCEPTION WHILE DISPLAYING AN ERROR TO THE USER:" ) sio = io.StringIO() traceback.print_exception( exc_info[0], exc_info[1], exc_info[2], file=sio ) logger.error( sio.getvalue() ) raise