class CustomException(exceptions.Exception): def __init__(self, error_info): Exception.__init__(self, error_info) self.error = error_info def __str__(self): return self.errortry: xxexcept: raise CustomException("自定义报错。。。。。。")