diff --git a/app.py b/app.py index cc1d5ec..212a871 100644 --- a/app.py +++ b/app.py @@ -203,6 +203,9 @@ def add(): spider = BarcodeSpider(x_rapidapi_key=X_RapidAPI_Key) good = spider.get_good(barcode) + if not good: + response_data = {"message": "Item not found"} + return jsonify(response_data), 400 try: if add_product(good, location): response_data = {"message": "New item added successfully"}