📜  如何在 python 代码示例中创建我自己的异常

📅  最后修改于: 2022-03-11 14:45:22.180000             🧑  作者: Mango

代码示例1
class MyException(Exception):
    pass

raise MyException("My hovercraft is full of eels")

"""With modern Python Exceptions, 
you don't need to abuse .message, or override .__str__() or .__repr__() 
or any of it. If all you want is an informative message when your 
exception is raised, do this