add logging to Exception

This commit is contained in:
Philipp 2022-10-07 19:53:34 +02:00
parent 64e4572e73
commit 4fc4b6a018
Signed by: Spaenny
GPG Key ID: 9EBD8439AFBAB750
1 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,9 @@ class Database:
logger.info(f"Connection to mysql got interrupted, trying to reconnect...")
self.con.reconnect()
self.init_test_database()
except Exception as err:
logger.error(f"Database interrupted: {err}")
raise Exception("Error while trying to connect to database.")
def create_reserved_slot(self, discord_user, steam_id):
cursor = self.con.cursor()
@ -46,3 +49,6 @@ class Database:
self.create_reserved_slot(discord_user, steam_id)
except mysql.connector.IntegrityError:
raise Exception("Duplicate entrys")
except Exception as err:
logger.error(f"Database interrupted: {err}")
raise Exception("Error while trying to connect to database.")