mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[V3 Sentry] Modify error logging cases (#1193)
* Fix duplicate on_ * Make better use of sentry error handler
This commit is contained in:
parent
f3da10ec98
commit
0979231435
@ -135,7 +135,7 @@ def init_events(bot, cli_flags):
|
|||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_error(event_method, *args, **kwargs):
|
async def on_error(event_method, *args, **kwargs):
|
||||||
sentry_log.exception("Exception in on_{}".format(event_method))
|
sentry_log.exception("Exception in {}".format(event_method))
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_command_error(ctx, error):
|
async def on_command_error(ctx, error):
|
||||||
@ -160,6 +160,10 @@ def init_events(bot, cli_flags):
|
|||||||
log.exception("Exception in command '{}'"
|
log.exception("Exception in command '{}'"
|
||||||
"".format(ctx.command.qualified_name),
|
"".format(ctx.command.qualified_name),
|
||||||
exc_info=error.original)
|
exc_info=error.original)
|
||||||
|
sentry_log.exception("Exception in command '{}'"
|
||||||
|
"".format(ctx.command.qualified_name),
|
||||||
|
exc_info=error.original)
|
||||||
|
|
||||||
message = ("Error in command '{}'. Check your console or "
|
message = ("Error in command '{}'. Check your console or "
|
||||||
"logs for details."
|
"logs for details."
|
||||||
"".format(ctx.command.qualified_name))
|
"".format(ctx.command.qualified_name))
|
||||||
@ -181,10 +185,13 @@ def init_events(bot, cli_flags):
|
|||||||
"".format(error.retry_after))
|
"".format(error.retry_after))
|
||||||
else:
|
else:
|
||||||
log.exception(type(error).__name__, exc_info=error)
|
log.exception(type(error).__name__, exc_info=error)
|
||||||
|
try:
|
||||||
|
sentry_error = error.original
|
||||||
|
except AttributeError:
|
||||||
|
sentry_error = error
|
||||||
|
|
||||||
sentry_log.exception("Exception in command '{}'"
|
sentry_log.exception("Unhandled command error.",
|
||||||
"".format(ctx.command.qualified_name),
|
exc_info=sentry_error)
|
||||||
exc_info=error.original)
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user