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
评论列表
文章目录