From 25c902c1940d2a7ae75b65fd755a5db4ff1174e8 Mon Sep 17 00:00:00 2001 From: Profitroll Date: Thu, 14 Dec 2023 01:09:04 +0200 Subject: [PATCH] Fixed the wrong exceptions being imported --- extensions/exceptions.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/extensions/exceptions.py b/extensions/exceptions.py index bd230ce..bf6660d 100644 --- a/extensions/exceptions.py +++ b/extensions/exceptions.py @@ -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) async def search_token_invalid_exception_handler( request: Request, exc: SearchTokenInvalidError @@ -114,7 +126,7 @@ async def search_token_invalid_exception_handler( return UJSONResponse( status_code=HTTP_401_UNAUTHORIZED, content={ - "detail": "Parameters 'page' and 'page_size' must be greater or equal to 1." + "detail": "Invalid search token." }, ) -- 2.39.2