Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /autonomi-ai_nos /nos /server /http /_exceptions.py
| from fastapi import status | |
| from fastapi.responses import JSONResponse | |
| from loguru import logger | |
| from starlette.requests import Request | |
| async def default_exception_middleware(request: Request, call_next): | |
| try: | |
| return await call_next(request) | |
| except Exception as exc: | |
| base_error_message = f"Internal server error: [method={request.method}], url={request.url}]" | |
| logger.error(f"Internal server error: [method={request.method}, url={request.url}, exc={exc}]") | |
| return JSONResponse( | |
| status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, | |
| content={"message": base_error_message}, | |
| ) | |
| async def default_exception_handler(request, error): | |
| """Default exception handler for all routes.""" | |
| base_error_message = f"Internal server error: [method={request.method}], url={request.url}]" | |
| logger.error(f"Internal server error: [method={request.method}, url={request.url}, error={error}]") | |
| return JSONResponse( | |
| status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, | |
| content={"message": f"{base_error_message}."}, | |
| ) | |
Xet Storage Details
- Size:
- 1.1 kB
- Xet hash:
- 0c1db0382d7b731909e9634f728e0c9158b51054bc453ec6f57fa22e259c95bb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.