From d5a9e8d52585aee8c5528b6f1884cea7df1e1c37 Mon Sep 17 00:00:00 2001 From: osmarks Date: Tue, 9 Feb 2021 18:04:52 +0000 Subject: [PATCH] fix errors erroring erroristically --- src/db.py | 2 +- src/main.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/db.py b/src/db.py index 6570ac2..1085f9f 100644 --- a/src/db.py +++ b/src/db.py @@ -95,7 +95,7 @@ async def init(db_path): aiosqlite.Connection._fetchone = _fetchone aiosqlite.Connection.execute_fetchone = execute_fetchone - version = (await (await db.execute("PRAGMA user_version")).fetchone())[0] + version = (await db.execute_fetchone("PRAGMA user_version"))[0] for i in range(version, len(migrations)): await db.executescript(migrations[i]) # Normally interpolating like this would be a terrible idea because of SQL injection. diff --git a/src/main.py b/src/main.py index 29e0509..9ad50c8 100644 --- a/src/main.py +++ b/src/main.py @@ -49,7 +49,8 @@ command_errors = prometheus_client.Counter("abr_errors", "Count of errors encoun async def on_command_error(ctx, err): #print(ctx, err) if isinstance(err, (commands.CommandNotFound, commands.CheckFailure)): return - if isinstance(err, (commands.MissingRequiredArgument, ValueError)): return await ctx.send(embed=util.error_embed(str(err))) + if isinstance(err, commands.CommandInvokeError) and isinstance(err.original, ValueError): return await ctx.send(embed=util.error_embed(str(err.original))) + if isinstance(err, commands.MissingRequiredArgument): return await ctx.send(embed=util.error_embed(str(err))) try: command_errors.inc() trace = re.sub("\n\n+", "\n", "\n".join(traceback.format_exception(err, err, err.__traceback__)))