-
-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: avoid crash if ingredients services called without ingredients_lc #11055
base: main
Are you sure you want to change the base?
Conversation
lib/ProductOpener/Ingredients.pm
Outdated
@@ -1604,7 +1604,7 @@ Array of specific ingredients. | |||
|
|||
sub parse_origins_from_text ($product_ref, $text) { | |||
|
|||
my $ingredients_lc = $product_ref->{ingredients_lc} || $product_ref->{lc}; | |||
my $ingredients_lc = $product_ref->{ingredients_lc} || $product_ref->{lc} || $product_ref->{lang}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where, if we add an Object approach, we could have a method for that on product. (would also work to define a sub get_product_lang)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm refactoring it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you add a test for this scenario ?
@alexgarel Thank you for the feedback. I refactored some things, and then that led to refactoring more things:
|
/update_tests_results |
Quality Gate passedIssues Measures |
fixes #11047
In the future, it would be a good thing to enable the services to add error messages that could be returned to the caller, when there is missing data for instance.