v2: better manifest error messages

This commit is contained in:
Jimmy Zelinskie 2016-10-03 10:13:39 -04:00
parent 218962e480
commit 6c6ef0f22a

View file

@ -100,7 +100,7 @@ def write_manifest_by_tagname(namespace_name, repo_name, manifest_ref):
try:
manifest = DockerSchema1Manifest(request.data)
except ManifestException as me:
raise ManifestInvalid(detail={'message': me.message})
raise ManifestInvalid(detail={'message': 'failed to parse manifest: %s' % me.message})
if manifest.tag != manifest_ref:
raise TagInvalid()
@ -118,7 +118,7 @@ def write_manifest_by_digest(namespace_name, repo_name, manifest_ref):
try:
manifest = DockerSchema1Manifest(request.data)
except ManifestException as me:
raise ManifestInvalid(detail={'message': me.message})
raise ManifestInvalid(detail={'message': 'failed to parse manifest: %s' % me.message})
if manifest.digest != manifest_ref:
raise ManifestInvalid(detail={'message': 'manifest digest mismatch'})
@ -172,7 +172,7 @@ def _write_manifest(namespace_name, repo_name, manifest):
rewritten_image.parent_image_id,
)
except ManifestException as me:
raise ManifestInvalid(detail={'message': me.message})
raise ManifestInvalid(detail={'message': 'failed synthesizing v1 metadata: %s' % me.message})
# Store the manifest pointing to the tag.
leaf_layer_id = rewritten_images[-1].image_id