mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
fixup
Signed-off-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
parent
8ea589b7b5
commit
22efbaceaa
3 changed files with 3 additions and 6 deletions
|
@ -53,6 +53,4 @@ class IncompleteData(Exception):
|
||||||
This exception is raised when a user sends incomplete data to the API
|
This exception is raised when a user sends incomplete data to the API
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, missing, *args, **kwargs):
|
pass
|
||||||
Exception.__init__(self, *args, **kwargs)
|
|
||||||
self.missing = missing
|
|
||||||
|
|
|
@ -85,8 +85,7 @@ class RecipeController(BaseRecipeController):
|
||||||
self.logger.error("No Entry Found on recipe controller action")
|
self.logger.error("No Entry Found on recipe controller action")
|
||||||
raise HTTPException(status_code=404, detail=ErrorResponse.respond(message="No Entry Found"))
|
raise HTTPException(status_code=404, detail=ErrorResponse.respond(message="No Entry Found"))
|
||||||
elif thrownType == exceptions.IncompleteData:
|
elif thrownType == exceptions.IncompleteData:
|
||||||
assert isinstance(ex.__context__, exceptions.IncompleteData)
|
missing = ex.args[-1]
|
||||||
missing = ex.__context__.missing
|
|
||||||
self.logger.error("Incomplete data provided to API route:", missing)
|
self.logger.error("Incomplete data provided to API route:", missing)
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
|
|
|
@ -393,7 +393,7 @@ class RecipeService(RecipeServiceBase):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if getattr(new_data, field) is None:
|
if getattr(new_data, field) is None:
|
||||||
raise exceptions.IncompleteData(field, "Incomplete recipe")
|
raise exceptions.IncompleteData("Incomplete recipe", field)
|
||||||
|
|
||||||
if recipe is None or recipe.settings is None:
|
if recipe is None or recipe.settings is None:
|
||||||
raise exceptions.NoEntryFound("Recipe not found.")
|
raise exceptions.NoEntryFound("Recipe not found.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue