The CLI can be… odd… when handling errors. Make them nicer for the CLI

This commit is contained in:
Joseph Schorr 2014-01-29 14:08:14 -05:00
parent 2b134158f5
commit 3dc3af9eb2
2 changed files with 4 additions and 5 deletions

View file

@ -128,7 +128,7 @@ def put_image_layer(namespace, repository, image_id):
mark_path = store.image_mark_path(namespace, repository, image_id)
if store.exists(layer_path) and not store.exists(mark_path):
abort(409, 'Image %(image_id)s already exists', issue='image-exists', image_id=image_id)
abort(409, 'Image already exists', issue='image-exists', image_id=image_id)
input_stream = request.stream
if request.headers.get('transfer-encoding') == 'chunked':
@ -364,7 +364,7 @@ def put_image_json(namespace, repository, image_id):
json_path = store.image_json_path(namespace, repository, image_id)
mark_path = store.image_mark_path(namespace, repository, image_id)
if store.exists(json_path) and not store.exists(mark_path):
abort(409, 'Image %(image_id)s already exists', issue='image-exists', image_id=image_id)
abort(409, 'Image already exists', issue='image-exists', image_id=image_id)
# If we reach that point, it means that this is a new image or a retry
# on a failed push

View file

@ -47,11 +47,10 @@ def abort(status_code, message=None, issue=None, **kwargs):
# Create the final response data and message.
data = {}
data['error'] = message
if issue_url:
data['info_url'] = issue_url
message = message + '. For more information: ' + issue_url
data['error'] = message
resp = jsonify(data)
resp.status_code = status_code