This commit is contained in:
Litchi Pi 2025-07-23 11:07:07 +02:00
commit e183dd1dcd
2 changed files with 9 additions and 4 deletions

View file

@ -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

View file

@ -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"))