import tornado.web
+from ..errors import NoSuchDistroError
+
from .handlers import BaseHandler
class CreateHandler(BaseHandler):
with self.db.transaction():
# Import the package
- package = await self.backend.packages.create(upload)
+ try:
+ package = await self.backend.packages.create(upload)
+
+ # If the distribution that is coded into the package could not be found,
+ # we will send that error to the user
+ except NoSuchDistroError as e:
+ # XXX probably send something better than this
+ raise tornado.web.HTTPError(404, "Could not find distribution: %s" % e)
- # XXX Fetch the distribution
# XXX Fetch the repository
repo = self.backend.repos.get_by_id(1)