added exception to attempted server connect
This commit is contained in:
parent
60c827d457
commit
b9f286ec69
1 changed files with 3 additions and 2 deletions
5
main.py
5
main.py
|
|
@ -1,6 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import socket
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
|
|
@ -90,7 +91,7 @@ class Admin(commands.Cog):
|
||||||
names = query.players.names
|
names = query.players.names
|
||||||
except asyncio.exceptions.TimeoutError:
|
except asyncio.exceptions.TimeoutError:
|
||||||
await log(ctx, "Setup query error, server lagging?")
|
await log(ctx, "Setup query error, server lagging?")
|
||||||
except ConnectionRefusedError:
|
except (ConnectionRefusedError, socket.gaierror):
|
||||||
await log(ctx, "Setup query failed, server down?")
|
await log(ctx, "Setup query failed, server down?")
|
||||||
else:
|
else:
|
||||||
mydb, cursor = connect()
|
mydb, cursor = connect()
|
||||||
|
|
@ -445,7 +446,7 @@ async def status_task(sid: int):
|
||||||
print(currServ.name, "Timeout, server lagging?")
|
print(currServ.name, "Timeout, server lagging?")
|
||||||
players = -1
|
players = -1
|
||||||
|
|
||||||
except ConnectionRefusedError:
|
except (ConnectionRefusedError, socket.gaierror):
|
||||||
print(currServ.name, "Cannot connect to server, down?")
|
print(currServ.name, "Cannot connect to server, down?")
|
||||||
players = -1
|
players = -1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue