refactor: remove all inline comments from code
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
"""Common error response schema and exception handlers."""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from fastapi import FastAPI, Request
|
||||
@@ -11,8 +9,6 @@ from app.core.exceptions import AppException
|
||||
|
||||
|
||||
class ErrorResponse(BaseModel):
|
||||
"""Standard error response format."""
|
||||
|
||||
status_code: int
|
||||
message: str
|
||||
details: dict | None = None
|
||||
@@ -20,7 +16,6 @@ class ErrorResponse(BaseModel):
|
||||
|
||||
|
||||
async def app_exception_handler(request: Request, exc: AppException) -> JSONResponse:
|
||||
"""Handle application exceptions with standard response."""
|
||||
return JSONResponse(
|
||||
status_code=exc.status_code,
|
||||
content={
|
||||
@@ -32,7 +27,6 @@ async def app_exception_handler(request: Request, exc: AppException) -> JSONResp
|
||||
|
||||
|
||||
async def http_exception_handler(request: Request, exc: HTTPException) -> JSONResponse:
|
||||
"""Handle HTTP exceptions with standard response."""
|
||||
return JSONResponse(
|
||||
status_code=exc.status_code,
|
||||
content={
|
||||
@@ -44,7 +38,6 @@ async def http_exception_handler(request: Request, exc: HTTPException) -> JSONRe
|
||||
|
||||
|
||||
def register_exception_handlers(app: FastAPI):
|
||||
"""Register all exception handlers with FastAPI app."""
|
||||
app.add_exception_handler(
|
||||
AppException,
|
||||
app_exception_handler, # type: ignore[arg-type]
|
||||
|
||||
Reference in New Issue
Block a user