Merge of the exceptions import fix #39
@ -107,6 +107,18 @@ async def search_page_invalid_exception_handler(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.exception_handler(SearchPageInvalidError)
|
||||||
|
async def search_token_invalid_exception_handler(
|
||||||
|
request: Request, exc: SearchPageInvalidError
|
||||||
|
):
|
||||||
|
return UJSONResponse(
|
||||||
|
status_code=HTTP_401_UNAUTHORIZED,
|
||||||
|
content={
|
||||||
|
"detail": "Parameters 'page' and 'page_size' must be greater or equal to 1."
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.exception_handler(SearchTokenInvalidError)
|
@app.exception_handler(SearchTokenInvalidError)
|
||||||
async def search_token_invalid_exception_handler(
|
async def search_token_invalid_exception_handler(
|
||||||
request: Request, exc: SearchTokenInvalidError
|
request: Request, exc: SearchTokenInvalidError
|
||||||
@ -114,7 +126,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."
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user