自定义异常类模板
作者:互联网
class CustomError(Exception):
def init(self,ErrorInfo):
super().init(self) #初始化父类
self.errorinfo=ErrorInfo
def str(self):
return self.errorinfo
if name == ‘main’:
try:
raise CustomError(‘客户异常’)
except CustomError as e:
print(e)
标签:errorinfo,自定义,self,init,def,ErrorInfo,异常,CustomError,模板 来源: https://blog.csdn.net/jiucai_96/article/details/110306931