Skip to content

Commit

Permalink
Also catch ValueErrors when extracting info from OFF
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandgeider committed Jun 5, 2024
1 parent a844397 commit 7d2165b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wger/nutrition/models/ingredient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7d2165b

Please sign in to comment.