exit if a TimeoutError
occurs
This commit is contained in:
parent
51a37c4562
commit
b29cf737a7
10
bert.py
10
bert.py
|
@ -140,10 +140,14 @@ def me(chan, msg):
|
||||||
|
|
||||||
|
|
||||||
def getData():
|
def getData():
|
||||||
raw = irc.recv(4096)
|
try:
|
||||||
|
raw = irc.recv(4096)
|
||||||
|
except TimeoutError:
|
||||||
|
print("Connection timed out!")
|
||||||
|
sys.exit(0)
|
||||||
if not raw:
|
if not raw:
|
||||||
print("Connection lost!")
|
print("Connection lost!")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
try:
|
try:
|
||||||
data = raw.decode("UTF-8")
|
data = raw.decode("UTF-8")
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user