add logging to Exception
This commit is contained in:
parent
64e4572e73
commit
4fc4b6a018
1 changed files with 6 additions and 0 deletions
|
@ -24,6 +24,9 @@ class Database:
|
||||||
logger.info(f"Connection to mysql got interrupted, trying to reconnect...")
|
logger.info(f"Connection to mysql got interrupted, trying to reconnect...")
|
||||||
self.con.reconnect()
|
self.con.reconnect()
|
||||||
self.init_test_database()
|
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):
|
def create_reserved_slot(self, discord_user, steam_id):
|
||||||
cursor = self.con.cursor()
|
cursor = self.con.cursor()
|
||||||
|
@ -46,3 +49,6 @@ class Database:
|
||||||
self.create_reserved_slot(discord_user, steam_id)
|
self.create_reserved_slot(discord_user, steam_id)
|
||||||
except mysql.connector.IntegrityError:
|
except mysql.connector.IntegrityError:
|
||||||
raise Exception("Duplicate entrys")
|
raise Exception("Duplicate entrys")
|
||||||
|
except Exception as err:
|
||||||
|
logger.error(f"Database interrupted: {err}")
|
||||||
|
raise Exception("Error while trying to connect to database.")
|
||||||
|
|
Loading…
Reference in a new issue