edmundmok / mealpy

Order your meals on MealPal automatically!
MIT License
28 stars 22 forks source link

Script fails if restaurant or meal doesn't exist #24

Open ipwnponies opened 5 years ago

ipwnponies commented 5 years ago

next() is used with no default, this will raise StopIteration if not matched: https://github.com/edmundmok/mealpy/blob/a580ab524e95d8e37a0f7484d34add21f842bf41/mealpy/mealpy.py#L88-L93

The behaviour of early exit is fine (we can't fallback to another option if it's ambiguous). We probably want to default to None, do truthy check , then print a a friendlier message to the user or raise a more meaningful error. This will be useful in the future, to do something like email the user when their meal could not be booked.