Merge "Improve the error msg of v2 image_data.py"

This commit is contained in:
Jenkins 2013-08-26 21:52:05 +00:00 committed by Gerrit Code Review
commit 6735fbb3f2

View File

@ -56,13 +56,15 @@ class ImageDataController(object):
LOG.debug("Cannot save data for image %s: %s", image_id, e)
raise webob.exc.HTTPBadRequest(explanation=unicode(e))
except exception.Duplicate as e:
msg = _("Unable to upload duplicate image data for image: %s")
LOG.debug(msg % image_id)
msg = (_("Unable to upload duplicate image data for image: %s") %
image_id)
LOG.debug(msg)
raise webob.exc.HTTPConflict(explanation=msg, request=req)
except exception.Forbidden as e:
msg = _("Not allowed to upload image data for image %s")
LOG.debug(msg % image_id)
msg = (_("Not allowed to upload image data for image %s") %
image_id)
LOG.debug(msg)
raise webob.exc.HTTPForbidden(explanation=msg, request=req)
except exception.NotFound as e: