Make ResumableUploadError derive from HttpError.
Fixes issue #242. Reviewed in https://codereview.appspot.com/7415048/.
This commit is contained in:
@@ -93,7 +93,7 @@ class MediaUploadSizeError(Error):
|
||||
pass
|
||||
|
||||
|
||||
class ResumableUploadError(Error):
|
||||
class ResumableUploadError(HttpError):
|
||||
"""Error occured during resumable upload."""
|
||||
pass
|
||||
|
||||
|
||||
@@ -744,7 +744,7 @@ class HttpRequest(object):
|
||||
if resp.status == 200 and 'location' in resp:
|
||||
self.resumable_uri = resp['location']
|
||||
else:
|
||||
raise ResumableUploadError("Failed to retrieve starting URI.")
|
||||
raise ResumableUploadError(resp, content)
|
||||
elif self._in_error_state:
|
||||
# If we are in an error state then query the server for current state of
|
||||
# the upload by sending an empty PUT and reading the 'range' header in
|
||||
|
||||
@@ -769,7 +769,11 @@ class Discovery(unittest.TestCase):
|
||||
'location': 'http://upload.example.com'}, ''),
|
||||
])
|
||||
|
||||
self.assertRaises(ResumableUploadError, request.execute, http=http)
|
||||
try:
|
||||
request.execute(http=http)
|
||||
self.fail('Should have raised ResumableUploadError.')
|
||||
except ResumableUploadError, e:
|
||||
self.assertEqual(400, e.resp.status)
|
||||
|
||||
def test_resumable_media_fail_unknown_response_code_subsequent_request(self):
|
||||
"""Not a multipart upload."""
|
||||
|
||||
Reference in New Issue
Block a user