Compare commits
3 Commits
v0.6.0
...
c3a9a2f40a
Author | SHA1 | Date | |
---|---|---|---|
c3a9a2f40a | |||
bcf74089f9 | |||
25c902c194 |
@@ -17,6 +17,7 @@ from classes.exceptions import (
|
|||||||
AlbumNotFoundError,
|
AlbumNotFoundError,
|
||||||
PhotoNotFoundError,
|
PhotoNotFoundError,
|
||||||
PhotoSearchQueryEmptyError,
|
PhotoSearchQueryEmptyError,
|
||||||
|
SearchLimitInvalidError,
|
||||||
SearchPageInvalidError,
|
SearchPageInvalidError,
|
||||||
SearchTokenInvalidError,
|
SearchTokenInvalidError,
|
||||||
UserAlreadyExists,
|
UserAlreadyExists,
|
||||||
@@ -95,12 +96,24 @@ async def video_search_query_empty_exception_handler(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.exception_handler(SearchLimitInvalidError)
|
||||||
|
async def search_limit_invalid_exception_handler(
|
||||||
|
request: Request, exc: SearchLimitInvalidError
|
||||||
|
):
|
||||||
|
return UJSONResponse(
|
||||||
|
status_code=HTTP_400_BAD_REQUEST,
|
||||||
|
content={
|
||||||
|
"detail": "Parameter 'limit' must be greater or equal to 1."
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.exception_handler(SearchPageInvalidError)
|
@app.exception_handler(SearchPageInvalidError)
|
||||||
async def search_page_invalid_exception_handler(
|
async def search_page_invalid_exception_handler(
|
||||||
request: Request, exc: SearchPageInvalidError
|
request: Request, exc: SearchPageInvalidError
|
||||||
):
|
):
|
||||||
return UJSONResponse(
|
return UJSONResponse(
|
||||||
status_code=HTTP_400_BAD_REQUEST,
|
status_code=HTTP_401_UNAUTHORIZED,
|
||||||
content={
|
content={
|
||||||
"detail": "Parameters 'page' and 'page_size' must be greater or equal to 1."
|
"detail": "Parameters 'page' and 'page_size' must be greater or equal to 1."
|
||||||
},
|
},
|
||||||
@@ -114,7 +127,7 @@ async def search_token_invalid_exception_handler(
|
|||||||
return UJSONResponse(
|
return UJSONResponse(
|
||||||
status_code=HTTP_401_UNAUTHORIZED,
|
status_code=HTTP_401_UNAUTHORIZED,
|
||||||
content={
|
content={
|
||||||
"detail": "Parameters 'page' and 'page_size' must be greater or equal to 1."
|
"detail": "Invalid search token."
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user