From 6942e24781877070618e13d0e9b975143d56b4b4 Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Thu, 21 Feb 2019 20:31:52 +0800 Subject: [PATCH] Response 404 for module product listings not found error --- product_listings_manager/products.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/product_listings_manager/products.py b/product_listings_manager/products.py index 779e492..a37683c 100644 --- a/product_listings_manager/products.py +++ b/product_listings_manager/products.py @@ -453,18 +453,15 @@ def getModuleProductListings(productLabel, moduleNVR): module_name = module['name'] module_stream = module['stream'] module_version = module['version'] - except KeyError: - raise koji.GenericError("It's not a module build: %s" % moduleNVR) + except (KeyError, TypeError): + raise ProductListingsNotFoundError("It's not a module build: %s" % moduleNVR) prodinfo = Products.get_product_info(compose_dbh, productLabel) - if not prodinfo: - # no product with the given label exists - raise koji.GenericError("Could not find a product with label: %s" % productLabel) version, variants = prodinfo module = Products.get_module(compose_dbh, module_name, module_stream, module_version) if not module: - raise koji.GenericError("Could not find a module build with NVR: %s" % moduleNVR) + raise ProductListingsNotFoundError("Could not find a module build with NVR: %s" % moduleNVR) module_id = module[0] listings = {}