From 7d2165b6bf3ea8a58bb08845320ffc26bb05bb25 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 5 Jun 2024 11:39:53 +0200 Subject: [PATCH] Also catch ValueErrors when extracting info from OFF --- wger/nutrition/models/ingredient.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wger/nutrition/models/ingredient.py b/wger/nutrition/models/ingredient.py index 38033025f..5c10c1922 100644 --- a/wger/nutrition/models/ingredient.py +++ b/wger/nutrition/models/ingredient.py @@ -442,7 +442,8 @@ def fetch_ingredient_from_off(cls, code: str): try: ingredient_data = extract_info_from_off(result, load_language(result['lang']).pk) - except KeyError: + except (KeyError, ValueError) as e: + logger.debug(f'Error extracting data from OFF: {e}') return None if not ingredient_data.name: