Skip to content

Commit 5a4df33

Browse files
422 code
1 parent c5a86ee commit 5a4df33

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/restful/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
):
9292
super().__init__(message, debug, data)
9393
self.type = self.__class__.__name__
94-
self.status = request_status.HTTP_422_UNPROCESSABLE_ENTITY
94+
self.status = request_status.HTTP_422_UNPROCESSABLE_CONTENT
9595

9696

9797
class NotImplementedException(ApplicationException):

src/restful/responses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ def wrapper_decorator(*args, **kwargs) -> TResponse | JSONResponse:
8686
if logger.level <= logging.DEBUG:
8787
traceback.print_exc()
8888
logger.debug(e)
89-
return JSONResponse(e.dict(), status_code=status.HTTP_422_UNPROCESSABLE_ENTITY)
89+
return JSONResponse(e.dict(), status_code=status.HTTP_422_UNPROCESSABLE_CONTENT)
9090
except ValidationError as e:
9191
validation_exception = ValidationException(message=str(e))
9292
if logger.level <= logging.DEBUG:
9393
traceback.print_exc()
94-
return JSONResponse(validation_exception.dict(), status_code=status.HTTP_422_UNPROCESSABLE_ENTITY)
94+
return JSONResponse(validation_exception.dict(), status_code=status.HTTP_422_UNPROCESSABLE_CONTENT)
9595
except NotFoundException as e:
9696
logger.debug(e)
9797
return JSONResponse(e.dict(), status_code=status.HTTP_404_NOT_FOUND)

src/utils/exception_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
async def validation_exception_handler(request: Request, exc: RequestValidationError):
1111
return JSONResponse(
1212
ErrorResponse(
13-
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
13+
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
1414
type="RequestValidationError",
1515
message="The received values are invalid",
1616
debug="The received values are invalid according to the endpoints model definition",
1717
extra=jsonable_encoder({"detail": exc.errors(), "body": exc.body}),
1818
).model_dump(),
19-
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
19+
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
2020
)

0 commit comments

Comments
 (0)