catch database connection errors
This commit is contained in:
parent
83ece2c59e
commit
d956760e4c
1 changed files with 10 additions and 5 deletions
|
@ -93,6 +93,7 @@ async def query_database():
|
|||
global database
|
||||
global rechead
|
||||
db_url = f'https://{scheduler_hostname}/database'
|
||||
try:
|
||||
if requests.get(db_url).status_code == 200:
|
||||
response = requests.get(db_url)
|
||||
response.raise_for_status()
|
||||
|
@ -100,6 +101,10 @@ async def query_database():
|
|||
else:
|
||||
logger_discord.error('Cannot connect to the database!')
|
||||
return
|
||||
except Exception as e:
|
||||
logger_discord.error('Cannot connect to the database!')
|
||||
logger_discord.error(e)
|
||||
return
|
||||
|
||||
if database == {}:
|
||||
logger_discord.error('Database is empty!')
|
||||
|
|
Loading…
Reference in a new issue