[refactor]: Clear error handling
This commit is contained in:
parent
f427fb38a2
commit
dad2f4abea
@ -12,11 +12,7 @@ class ErrHandler(Cog):
|
|||||||
bot.tree.error(self.on_error)
|
bot.tree.error(self.on_error)
|
||||||
|
|
||||||
async def on_error(self, inter, error):
|
async def on_error(self, inter, error):
|
||||||
logger.error(error)
|
logger.error(print_exc())
|
||||||
logger.warning(print_exc())
|
|
||||||
info = exc_info()
|
|
||||||
logger.error(info)
|
|
||||||
logger.error(print_tb(info[2]))
|
|
||||||
|
|
||||||
errors_text = await self.bot.tree.translator.translate(
|
errors_text = await self.bot.tree.translator.translate(
|
||||||
app_commands.locale_str("errors_text"),
|
app_commands.locale_str("errors_text"),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
from traceback import print_tb
|
||||||
|
|
||||||
class Errors(commands.Cog):
|
class Errors(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
@ -27,7 +28,8 @@ class Errors(commands.Cog):
|
|||||||
elif isinstance(error, commands.CheckFailure):
|
elif isinstance(error, commands.CheckFailure):
|
||||||
await ctx.send('Команда недоступна')
|
await ctx.send('Команда недоступна')
|
||||||
else:
|
else:
|
||||||
logger.error(error.__traceback__)
|
logger.debug(error)
|
||||||
|
logger.error(print_tb(error))
|
||||||
# missing = [perm.replace('_', ' ').replace('guild', 'server').title() for perm in error.missing_perms]
|
# missing = [perm.replace('_', ' ').replace('guild', 'server').title() for perm in error.missing_perms]
|
||||||
# if len(missing) > 2:
|
# if len(missing) > 2:
|
||||||
# fmt = '{}, и {}'.format("**, **".join(missing[:-1]), missing[-1])
|
# fmt = '{}, и {}'.format("**, **".join(missing[:-1]), missing[-1])
|
||||||
|
Reference in New Issue
Block a user