fix errors erroring erroristically

This commit is contained in:
osmarks 2021-02-09 18:04:52 +00:00
parent bd3b70314d
commit d5a9e8d525
2 changed files with 3 additions and 2 deletions

View File

@ -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.

View File

@ -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__)))