Feed error messages through a cors wrapper so that people on other domains can see what's happening.

This commit is contained in:
jakedt 2014-03-17 16:57:35 -04:00
parent 4673f40dd2
commit 3b3d71bfd7
18 changed files with 162 additions and 129 deletions

View file

@ -1,11 +1,10 @@
import json
from collections import defaultdict
from flask.ext.restful import abort
from app import app
from endpoints.api import (resource, nickname, require_repo_read, RepositoryParamResource,
format_date)
format_date, NotFound)
from data import model
from util.cache import cache_control_flask_restful
@ -64,7 +63,7 @@ class RepositoryImage(RepositoryParamResource):
""" Get the information available for the specified image. """
image = model.get_repo_image(namespace, repository, image_id)
if not image:
abort(404)
raise NotFound()
return image_view(image)
@ -81,7 +80,7 @@ class RepositoryImageChanges(RepositoryParamResource):
image = model.get_repo_image(namespace, repository, image_id)
if not image:
abort(404)
raise NotFound()
uuid = image.storage and image.storage.uuid
diffs_path = store.image_file_diffs_path(namespace, repository, image_id, uuid)
@ -90,4 +89,4 @@ class RepositoryImageChanges(RepositoryParamResource):
response_json = json.loads(store.get_content(diffs_path))
return response_json
except IOError:
abort(404)
raise NotFound()