mirror of
https://github.com/osmarks/autobotrobot
synced 2025-01-22 21:26:52 +00:00
fix errors erroring erroristically
This commit is contained in:
parent
bd3b70314d
commit
d5a9e8d525
@ -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.
|
||||
|
@ -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__)))
|
||||
|
Loading…
Reference in New Issue
Block a user