forked from cswimr/SeaCogs
fix(aurora): sqlite3 uses OperationalErrors, not ProgrammingErrors
This commit is contained in:
parent
4226d0b6fe
commit
3087afa1d2
2 changed files with 4 additions and 4 deletions
|
@ -946,7 +946,7 @@ class Aurora(commands.Cog):
|
||||||
try:
|
try:
|
||||||
cursor.execute(tempban_query, (time.time(),))
|
cursor.execute(tempban_query, (time.time(),))
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
except sqlite3.ProgrammingError:
|
except sqlite3.OperationalError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
target_ids = [row[0] for row in result]
|
target_ids = [row[0] for row in result]
|
||||||
|
@ -973,7 +973,7 @@ class Aurora(commands.Cog):
|
||||||
try:
|
try:
|
||||||
cursor.execute(blacklist_query, (time.time(),))
|
cursor.execute(blacklist_query, (time.time(),))
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
except sqlite3.ProgrammingError:
|
except sqlite3.OperationalError:
|
||||||
continue
|
continue
|
||||||
target_ids = [row[0] for row in result]
|
target_ids = [row[0] for row in result]
|
||||||
moderation_ids = [row[1] for row in result]
|
moderation_ids = [row[1] for row in result]
|
||||||
|
|
|
@ -18,7 +18,7 @@ def connect() -> sqlite3.Connection:
|
||||||
connection = sqlite3.connect(database=data_manager.cog_data_path(raw_name='Aurora') / 'aurora.db')
|
connection = sqlite3.connect(database=data_manager.cog_data_path(raw_name='Aurora') / 'aurora.db')
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
except sqlite3.ProgrammingError as e:
|
except sqlite3.OperationalError as e:
|
||||||
logger.error("Unable to access the SQLite database!\nError:\n%s", e.msg)
|
logger.error("Unable to access the SQLite database!\nError:\n%s", e.msg)
|
||||||
raise ConnectionRefusedError(
|
raise ConnectionRefusedError(
|
||||||
f"Unable to access the SQLite Database!\n{e.msg}"
|
f"Unable to access the SQLite Database!\n{e.msg}"
|
||||||
|
@ -33,7 +33,7 @@ async def create_guild_table(guild: Guild):
|
||||||
cursor.execute(f"SELECT * FROM `moderation_{guild.id}`")
|
cursor.execute(f"SELECT * FROM `moderation_{guild.id}`")
|
||||||
logger.debug("SQLite Table exists for server %s (%s)", guild.name, guild.id)
|
logger.debug("SQLite Table exists for server %s (%s)", guild.name, guild.id)
|
||||||
|
|
||||||
except sqlite3.ProgrammingError:
|
except sqlite3.OperationalError:
|
||||||
query = f"""
|
query = f"""
|
||||||
CREATE TABLE `moderation_{guild.id}` (
|
CREATE TABLE `moderation_{guild.id}` (
|
||||||
moderation_id INTEGER PRIMARY KEY,
|
moderation_id INTEGER PRIMARY KEY,
|
||||||
|
|
Loading…
Reference in a new issue