Spaces:
Runtime error
Runtime error
Download TechdocsAPI/backend/core/ExceptionHandlers.py from CaffeineCrew/Techdocs: direct link, hf CLI and curl.
- Browser
- Download file 953 Bytes
-
https://huggingface.co/spaces/CaffeineCrew/Techdocs/resolve/9a76ca9b77d2dbd7b13fbcc486de359653fe2bf4/TechdocsAPI/backend/core/ExceptionHandlers.py
- Command line
-
hf download hf://spaces/CaffeineCrew/Techdocs@9a76ca9b77d2dbd7b13fbcc486de359653fe2bf4/TechdocsAPI/backend/core/ExceptionHandlers.py
-
curl -L -o ExceptionHandlers.py https://huggingface.co/spaces/CaffeineCrew/Techdocs/resolve/9a76ca9b77d2dbd7b13fbcc486de359653fe2bf4/TechdocsAPI/backend/core/ExceptionHandlers.py
953 Bytes
| from backend import app | |
| from .Exceptions import * | |
| from fastapi.responses import JSONResponse | |
| from fastapi.requests import Request | |
| from fastapi import status | |
| async def handle_existing_user_found(request: Request, exec: ExistingUserException): | |
| return JSONResponse(status_code=status.HTTP_226_IM_USED, | |
| content=repr(exec) | |
| ) | |
| async def handle_login_failed(request: Request, exec: InvalidCredentialsException): | |
| return JSONResponse(status_code=status.HTTP_403_FORBIDDEN, | |
| content=repr(exec) | |
| ) | |
| async def handle_info_not_found(request: Request, exec: InfoNotFoundException): | |
| return JSONResponse(status_code=status.HTTP_401_UNAUTHORIZED, | |
| content=repr(exec) | |
| ) |