From e183dd1dcdf71f609e9295c1c723b02df7abdc57 Mon Sep 17 00:00:00 2001 From: Litchi Pi Date: Wed, 23 Jul 2025 11:07:07 +0200 Subject: [PATCH] format --- mealie/core/exceptions.py | 2 ++ mealie/routes/recipe/recipe_crud_routes.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mealie/core/exceptions.py b/mealie/core/exceptions.py index de8cf7d39..077a8644d 100644 --- a/mealie/core/exceptions.py +++ b/mealie/core/exceptions.py @@ -47,8 +47,10 @@ class UserLockedOut(Exception): ... class MissingClaimException(Exception): ... + class IncompleteData(Exception): """ This exception is raised when a user sends incomplete data to the API """ + pass diff --git a/mealie/routes/recipe/recipe_crud_routes.py b/mealie/routes/recipe/recipe_crud_routes.py index dd4a9fa25..9d236bf0c 100644 --- a/mealie/routes/recipe/recipe_crud_routes.py +++ b/mealie/routes/recipe/recipe_crud_routes.py @@ -86,7 +86,10 @@ class RecipeController(BaseRecipeController): raise HTTPException(status_code=404, detail=ErrorResponse.respond(message="No Entry Found")) elif thrownType == exceptions.IncompleteData: self.logger.error("Incomplete data provided to API route") - raise HTTPException(status_code=400, detail=ErrorResponse.respond(message="Some data were missing on the body of this API request")) + raise HTTPException( + status_code=400, + detail=ErrorResponse.respond(message="Some data were missing on the body of this API request"), + ) elif thrownType == sqlalchemy.exc.IntegrityError: self.logger.error("SQL Integrity Error on recipe controller action") raise HTTPException(status_code=400, detail=ErrorResponse.respond(message="Recipe already exists")) @@ -364,11 +367,11 @@ class RecipeController(BaseRecipeController): @router.put("/{slug}") def update_one(self, slug: str, data: Recipe): """ - Updates a recipe by existing slug and data. + Updates a recipe by existing slug and data. - Requires all the fields of the recipe to be passed in the body + Requires all the fields of the recipe to be passed in the body - If you wish to update parts of the recipe only, use a PATCH request to this route + If you wish to update parts of the recipe only, use a PATCH request to this route """ try: recipe = self.service.update_one(slug, data, strict=True)