python 自定义异常
class CustomException(exceptions.Exception): def __init__(self, error_info): Exception.__init__(self, error_info) self.error = error_info def __str__(self): return self.error
try:
xx
except:
raise CustomException("自定义报错。。。。。。")
class CustomException(exceptions.Exception): def __init__(self, error_info): Exception.__init__(self, error_info) self.error = error_info def __str__(self): return self.error
try:
xx
except:
raise CustomException("自定义报错。。。。。。")