-
Notifications
You must be signed in to change notification settings - Fork 10
/
Error.py
45 lines (36 loc) · 1.32 KB
/
Error.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class Error:
def __init__(self):
self.dns = 0 # Name or service not known | DNS
self.conntimeout = 0
self.pooltimeout = 0
self.reset = 0
self.refuse = 0
self.others = 0
# record list
self.rdns = []
self.rconntimeout = []
self.rpooltimeout = []
self.rreset = []
self.rrefuse = []
self.rothers = []
self.lasterrurl = ""
def __str__(self):
total = self.dns+self.conntimeout+self.pooltimeout+self.reset+self.refuse+self.others
if total <= 0:
return ""
str = "[ERROR:%d " % total
if self.dns > 0:
str += "DNS:%d " % self.dns
if self.conntimeout > 0:
str += "CONN:%d " % self.conntimeout
if self.reset > 0:
str += "RESET:%d " % self.reset
if self.refuse > 0:
str += "REFUSE:%d " % self.refuse
if self.pooltimeout > 0:
str += "POOL:%d " % self.pooltimeout
if self.others > 0:
str += "OTHERS:%d" % self.others
if len(str) > 0:
str += " %s ]" % (self.lasterrurl)
return str