error_handler.py 文件源码

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

项目:HAHA-NO-UR 作者: DamourYouKnow 项目源码 文件源码
def command_error_handler(exception: Exception):
    """
    A function that handles command errors
    :param exception: the exception raised
    :return: the message to be sent based on the exception type
    """
    ex_str = str(exception)
    if isinstance(exception, (CommandOnCooldown, NoMongo)):
        return ex_str
    if isinstance(exception, HTTPStatusError):
        return f'Something went wrong with the HTTP request.\n{ex_str}'
    raise exception
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号