class VideoException(Exception): """ VOD上传SDK的异常类,做统一的异常处理,外部捕获此异常即可 """ def __init__(self, type, code, msg, http_status=None, request_id=None): Exception.__init__(self) self.type = type or 'UnkownError' self.code = code self.message = msg self.http_status = http_status or 'NULL' self.request_id = request_id or 'NULL' def __str__(self): return "Type: %s, Code: %s, Message: %s, HTTPStatus: %s, RequestId: %s" % ( self.type, self.code, self.message, str(self.http_status), self.request_id)