(config, etype, value, tb)
Formats traceback and exception data and emails the error

    @param etype: Exception class type
    @param value: Exception string value
    @param tb: Traceback string data
Formats traceback and exception data and emails the error
Formats traceback and exception data and emails the error
def sendexceptionmail(config, etype, value, tb):
    """
    Formats traceback and exception data and emails the error

    @param etype: Exception class type
    @param value: Exception string value
    @param tb: Traceback string data
    """
    exc_type = re.sub("(<(type|class ')|'exceptions.|'>|__main__.)", "", str(etype))

    tmp = ["From: Tor2web Node %s.%s <%s>\n" % (config.nodename, config.basehost, config.smtpmail),
           "To: %s\n" % config.smtpmailto_exceptions,
           "Subject: Tor2web Node Exception (IPV4: %s, IPv6: %s)\n" % (config.listen_ipv4, config.listen_ipv6),
           "Content-Type: text/plain; charset=ISO-8859-1\n", "Content-Transfer-Encoding: 8bit\n\n",
           "Exception from Node %s (IPV4: %s, IPv6: %s)\n" % (config.nodename, config.listen_ipv4, config.listen_ipv6),
           "Tor2web version: %s\n" % __version__]

    error_message = "%s %s" % (exc_type.strip(), etype.__doc__)
    tmp.append(error_message)

    traceinfo = '\n'.join(traceback.format_exception(etype, value, tb))
    tmp.append(traceinfo)

    info_string = ''.join(tmp)
    message = StringIO(info_string)

    sendmail(config, config.smtpmailto_exceptions, message)
def sendexceptionmail ( config , etype , value , tb ) : exc_type = re . sub ( "(<(type|class ')|'exceptions.|'>|__main__.)" , "" , str ( etype ) ) tmp = [ "From: Tor2web Node %s.%s <%s>\n" % ( config . nodename , config . basehost , config . smtpmail ) , "To: %s\n" % config . smtpmailto_exceptions , "Subject: Tor2web Node Exception (IPV4: %s, IPv6: %s)\n" % ( config . listen_ipv4 , config . listen_ipv6 ) , "Content-Type: text/plain; charset=ISO-8859-1\n" , "Content-Transfer-Encoding: 8bit\n\n" , "Exception from Node %s (IPV4: %s, IPv6: %s)\n" % ( config . nodename , config . listen_ipv4 , config . listen_ipv6 ) , "Tor2web version: %s\n" % __version__ ] error_message = "%s %s" % ( exc_type . strip ( ) , etype . __doc__ ) tmp . append ( error_message ) traceinfo = '\n' . join ( traceback . format_exception ( etype , value , tb ) ) tmp . append ( traceinfo ) info_string = '' . join ( tmp ) message = StringIO ( info_string ) sendmail ( config , config . smtpmailto_exceptions , message )