From: Michael Tremer Date: Tue, 18 Oct 2022 18:01:50 +0000 (+0000) Subject: hub: Extract the distribution from package X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4abd7ae3f17b06741120811c4c7ebde8ff8b7820;p=pbs.git hub: Extract the distribution from package Signed-off-by: Michael Tremer --- diff --git a/src/hub/builds.py b/src/hub/builds.py index 49cf54b3..fe4de450 100644 --- a/src/hub/builds.py +++ b/src/hub/builds.py @@ -21,6 +21,8 @@ import tornado.web +from ..errors import NoSuchDistroError + from .handlers import BaseHandler class CreateHandler(BaseHandler): @@ -36,9 +38,15 @@ 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)