From efee9b27188ecac077c68796a34bc75497340b6b Mon Sep 17 00:00:00 2001 From: yyasha Date: Sat, 27 Jan 2024 21:58:35 +0300 Subject: [PATCH] change error handling --- internal/parser/parser.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 985c576..2bd9407 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -234,7 +234,10 @@ func GetRecipe(r *models.Recipe, ps pictureSaver, rs recipeSaver, rp recipeProvi }) // check recipe exists ex, err := rp.RecipeExists(context.Background(), r.Title) // interface! - if err != nil || ex { + if err != nil { + return fmt.Errorf("%s: %w", op, err) + } + if ex { return fmt.Errorf("%s: %w", op, ErrRecipeExists) } // save picture