change error handling
This commit is contained in:
parent
825957a1e9
commit
efee9b2718
|
@ -234,7 +234,10 @@ func GetRecipe(r *models.Recipe, ps pictureSaver, rs recipeSaver, rp recipeProvi
|
||||||
})
|
})
|
||||||
// check recipe exists
|
// check recipe exists
|
||||||
ex, err := rp.RecipeExists(context.Background(), r.Title) // interface!
|
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)
|
return fmt.Errorf("%s: %w", op, ErrRecipeExists)
|
||||||
}
|
}
|
||||||
// save picture
|
// save picture
|
||||||
|
|
Loading…
Reference in New Issue