Spaces:
Sleeping
Sleeping
Download app/api/v1/errors.py from baljot07/studiq-backend: direct link, hf CLI and curl.
- Browser
- Download file 754 Bytes
-
https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/app/api/v1/errors.py
- Command line
-
hf download hf://spaces/baljot07/studiq-backend/app/api/v1/errors.py
-
curl -L -o errors.py https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/app/api/v1/errors.py
754 Bytes
| """Client-side error reporting.""" | |
| from fastapi import APIRouter, Depends | |
| from pydantic import BaseModel | |
| from app.core.dependencies import get_current_user | |
| from app.models.user import User | |
| import logging | |
| logger = logging.getLogger(__name__) | |
| router = APIRouter(prefix="/errors", tags=["Error Reporting"]) | |
| class ErrorReport(BaseModel): | |
| screen: str | |
| error: str | |
| context: str = "" | |
| platform: str = "flutter" | |
| timestamp: str = "" | |
| async def report_error( | |
| body: ErrorReport, | |
| user: User = Depends(get_current_user), | |
| ): | |
| logger.warning( | |
| f"Client error | user={user.id} | " | |
| f"screen={body.screen} | error={body.error} | " | |
| f"context={body.context}" | |
| ) | |
| return {"received": True} | |