|
|
@@ -215,38 +215,38 @@ def catch_error(method): |
|
|
|
try: |
|
|
|
return method(self, *args, **kwargs) |
|
|
|
except ServerException as e: |
|
|
|
logger.error("阿里云ServerException异常, error_code: {}, error_msg:{}, status:{}, requestId:{}", |
|
|
|
e.get_error_code(), e.get_error_msg(), e.get_http_status(), self.__requestId) |
|
|
|
logger.error("阿里云ServerException异常, error_code: {}, error_msg:{}, status:{}", |
|
|
|
e.get_error_code(), e.get_error_msg(), e.get_http_status()) |
|
|
|
# 可能原因:AK错误、账号无权限、参数错误等 |
|
|
|
raise AliyunVodException('ServerException', e.get_error_code(), e.get_error_msg(), e.get_http_status(), |
|
|
|
e.get_request_id()) |
|
|
|
except ClientException as e: |
|
|
|
logger.error("阿里云ClientException异常, error_code: {}, error_msg:{}, requestId:{}", e.get_error_code(), |
|
|
|
e.get_error_msg(), self.__requestId) |
|
|
|
logger.error("阿里云ClientException异常, error_code: {}, error_msg:{}", e.get_error_code(), |
|
|
|
e.get_error_msg()) |
|
|
|
# 可能原因:本地网络故障(如不能连接外网)等 |
|
|
|
raise AliyunVodException('ClientException', e.get_error_code(), e.get_error_msg()) |
|
|
|
except OssError as e: |
|
|
|
logger.error("阿里云OssError异常, error_code: {}, error_msg:{}, status:{}, requestId:{}", e.code, e.message, |
|
|
|
e.status, self.__requestId) |
|
|
|
logger.error("阿里云OssError异常, error_code: {}, error_msg:{}, status:{}", e.code, e.message, |
|
|
|
e.status) |
|
|
|
# 可能原因:上传凭证过期等 |
|
|
|
raise AliyunVodException('OssError', e.code, e.message, e.status, e.request_id) |
|
|
|
except IOError as e: |
|
|
|
logger.error("阿里云IOError异常: {}, requestId:{}", traceback.format_exc(), self.__requestId) |
|
|
|
logger.error("阿里云IOError异常: {}", traceback.format_exc()) |
|
|
|
# 可能原因:文件URL不能访问、本地文件无法读取等 |
|
|
|
raise AliyunVodException('IOError', repr(e), traceback.format_exc()) |
|
|
|
except OSError as e: |
|
|
|
logger.error("阿里云OSError异常: {}, requestId:{}", traceback.format_exc(), self.__requestId) |
|
|
|
logger.error("阿里云OSError异常: {}", traceback.format_exc()) |
|
|
|
# 可能原因:本地文件不存在等 |
|
|
|
raise AliyunVodException('OSError', repr(e), traceback.format_exc()) |
|
|
|
except AliyunVodException as e: |
|
|
|
logger.error("阿里云VodException异常: {}, requestId:{}", e, self.__requestId) |
|
|
|
logger.error("阿里云VodException异常: {}", e) |
|
|
|
# 可能原因:参数错误 |
|
|
|
raise e |
|
|
|
except Exception as e: |
|
|
|
logger.error("阿里云UnkownException异常: {}, requestId:{}", traceback.format_exc(), self.__requestId) |
|
|
|
logger.error("阿里云UnkownException异常: {}", traceback.format_exc()) |
|
|
|
raise AliyunVodException('UnkownException', repr(e), traceback.format_exc()) |
|
|
|
except: |
|
|
|
logger.error("阿里云UnkownError异常: {}, requestId:{}", traceback.format_exc(), self.__requestId) |
|
|
|
logger.error("阿里云UnkownError异常: {}", traceback.format_exc()) |
|
|
|
raise AliyunVodException('UnkownError', 'UnkownError', traceback.format_exc()) |
|
|
|
return wrapper |
|
|
|
|