diff --git a/mealie/core/exceptions.py b/mealie/core/exceptions.py index 65d6b1bb4..077a8644d 100644 --- a/mealie/core/exceptions.py +++ b/mealie/core/exceptions.py @@ -53,6 +53,4 @@ class IncompleteData(Exception): This exception is raised when a user sends incomplete data to the API """ - def __init__(self, missing, *args, **kwargs): - Exception.__init__(self, *args, **kwargs) - self.__context__["missing"] = missing + pass diff --git a/mealie/routes/recipe/recipe_crud_routes.py b/mealie/routes/recipe/recipe_crud_routes.py index d06f77d9f..117d7efd8 100644 --- a/mealie/routes/recipe/recipe_crud_routes.py +++ b/mealie/routes/recipe/recipe_crud_routes.py @@ -85,7 +85,9 @@ class RecipeController(BaseRecipeController): self.logger.error("No Entry Found on recipe controller action") raise HTTPException(status_code=404, detail=ErrorResponse.respond(message="No Entry Found")) elif thrownType == exceptions.IncompleteData: - missing = ex.__context__["missing"] + print(ex.args) + print(ex.__context__) + missing = ex.__context__.missing self.logger.error("Incomplete data provided to API route:", missing) raise HTTPException( status_code=400, diff --git a/mealie/services/recipe/recipe_service.py b/mealie/services/recipe/recipe_service.py index a36deab27..9a0ce09fd 100644 --- a/mealie/services/recipe/recipe_service.py +++ b/mealie/services/recipe/recipe_service.py @@ -393,7 +393,7 @@ class RecipeService(RecipeServiceBase): continue if getattr(new_data, field) is None: - raise exceptions.IncompleteData(field, f"Incomplete recipe, missing {field}") + raise exceptions.IncompleteData("Incomplete recipe", missing=field) if recipe is None or recipe.settings is None: raise exceptions.NoEntryFound("Recipe not found.")