error_handler.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:HAHA-NO-UR 作者: DamourYouKnow 项目源码 文件源码
def format_command_error(ex: Exception, context: Context) -> tuple:
    """
    Format a command error to display and log.
    :param ex: the exception raised.
    :param context: the context.
    :return: a message to be displayed and logged, and triggered message
    """
    triggered = context.message.content
    four_space = ' ' * 4
    ex_type = type(ex).__name__
    msg = (
        f'{four_space}Triggered message: {triggered}\n'
        f'{four_space}Type: {ex_type}\n'
        f'{four_space}Exception: {ex}'
    )

    return msg, triggered
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号