Make blob upload errors more specific
This commit is contained in:
parent
d18a7935e1
commit
88f19ee0b9
2 changed files with 10 additions and 3 deletions
|
@ -10,7 +10,8 @@ from data import database
|
|||
from data.registry_model import registry_model
|
||||
from data.registry_model.blobuploader import (create_blob_upload, retrieve_blob_upload_manager,
|
||||
complete_when_uploaded, BlobUploadSettings,
|
||||
BlobUploadException, BlobTooLargeException)
|
||||
BlobUploadException, BlobTooLargeException,
|
||||
BlobRangeMismatchException)
|
||||
from digest import digest_tools
|
||||
from endpoints.decorators import anon_protect, parse_repository_name
|
||||
from endpoints.v2 import v2_bp, require_repo_read, require_repo_write, get_input_stream
|
||||
|
@ -428,7 +429,10 @@ def _upload_chunk(blob_uploader, commit_digest=None):
|
|||
return blob_uploader.commit_to_blob(app.config, commit_digest)
|
||||
except BlobTooLargeException as ble:
|
||||
raise LayerTooLarge(uploaded=ble.uploaded, max_allowed=ble.max_allowed)
|
||||
except BlobUploadException:
|
||||
except BlobRangeMismatchException:
|
||||
logger.exception('Exception when uploading blob to %s', blob_uploader.blob_upload_id)
|
||||
_abort_range_not_satisfiable(blob_uploader.blob_upload.byte_count,
|
||||
blob_uploader.blob_upload_id)
|
||||
except BlobUploadException:
|
||||
logger.exception('Exception when uploading blob to %s', blob_uploader.blob_upload_id)
|
||||
raise BlobUploadInvalid()
|
||||
|
|
Reference in a new issue