From 29903af085a515233120d27fa92505fa16d9fb90 Mon Sep 17 00:00:00 2001 From: Jakob Wenzel Date: Thu, 7 Jan 2021 19:49:02 +0100 Subject: [PATCH] catch error when trying to parse into ingredient/note --- cookbook/helper/ingredient_parser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cookbook/helper/ingredient_parser.py b/cookbook/helper/ingredient_parser.py index 47fc8759a..299e4718f 100644 --- a/cookbook/helper/ingredient_parser.py +++ b/cookbook/helper/ingredient_parser.py @@ -129,6 +129,9 @@ def parse(x): # only two arguments, first one is the amount which means this is the ingredient ingredient = tokens[1] except ValueError: - # can't parse first argument as amount -> no unit -> parse everything as ingredient - ingredient, note = parse_ingredient(tokens) + try: + # can't parse first argument as amount -> no unit -> parse everything as ingredient + ingredient, note = parse_ingredient(tokens) + except ValueError: + ingredient = ' '.join(tokens[1:]) return amount, unit.strip(), ingredient.strip(), note.strip()