(trace=None, log=True, console=True)
Any errors are sent to here.
Any errors are sent to here.
Any errors are sent to here .
def handle_error(trace=None, log=True, console=True):
    """Any errors are sent to here."""
    if trace is not None:
    
        #Generate output
        output = ['Mouse Tracks {} ({}) | Python {} | {}'.format(VERSION, FILE_VERSION, PYTHON_VERSION, OPERATING_SYSTEM)]
        output.append('')
        output.append(trace)
        output = '\n'.join(output)
        
        #Write to file
        if log:
            file_name = format_file_path('{}\\error.txt'.format(DEFAULT_PATH))
            with TextFile(file_name, 'w') as f:
                f.write(output)
        Message(trace.strip())
        
        #Output information to quit/restart
        #The try/except is in case the language code has failed
        try:
            error_message = LANGUAGE.strings['Misc']['ProgramError']
        except KeyError:
            error_message = 'An error occurred.'
        try:
            restart_message = LANGUAGE.strings['Misc']['ProgramRestart']
        except KeyError:
            restart_message = 'Please restart the program...'
        try:
            exit_message = LANGUAGE.strings['Misc']['ProgramExit']
        except KeyError:
            exit_message = 'Press enter to exit..'

        if console:
            input('{} {}'.format(error_message, exit_message))
        else:
            return Message('{} {}'.format(error_message, restart_message))
    sys.exit(0)
def handle_error ( trace = None , log = True , console = True ) : if trace is not None : #Generate output output = [ 'Mouse Tracks {} ({}) | Python {} | {}' . format ( VERSION , FILE_VERSION , PYTHON_VERSION , OPERATING_SYSTEM ) ] output . append ( '' ) output . append ( trace ) output = '\n' . join ( output ) #Write to file if log : file_name = format_file_path ( '{}\\error.txt' . format ( DEFAULT_PATH ) ) with TextFile ( file_name , 'w' ) as f : f . write ( output ) Message ( trace . strip ( ) ) #Output information to quit/restart #The try/except is in case the language code has failed try : error_message = LANGUAGE . strings [ 'Misc' ] [ 'ProgramError' ] except KeyError : error_message = 'An error occurred.' try : restart_message = LANGUAGE . strings [ 'Misc' ] [ 'ProgramRestart' ] except KeyError : restart_message = 'Please restart the program...' try : exit_message = LANGUAGE . strings [ 'Misc' ] [ 'ProgramExit' ] except KeyError : exit_message = 'Press enter to exit..' if console : input ( '{} {}' . format ( error_message , exit_message ) ) else : return Message ( '{} {}' . format ( error_message , restart_message ) ) sys . exit ( 0 )