Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Also catch ValueErrors when extracting info from OFF

Roland Geider7d2165b6bf3e
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 @@ class Ingredient(AbstractLicenseModel, models.Model):
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: