fix: FormData not JSON serializable in validation handler, dashboard log to INFO

This commit is contained in:
2026-07-05 19:55:30 +07:00
parent 539957d9b5
commit eeabc6be6f
2 changed files with 5 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ async def dashboard(request: Request):
)
total_revenue = float((await session.execute(rev_stmt)).scalar_one())
logger.debug(
logger.info(
"Dashboard data: users={}/{} tariffs={} servers={}/{} payments={}/{} revenue={}",
active_users, total_users, total_tariffs,
active_servers, total_servers,

View File

@@ -62,11 +62,14 @@ async def validation_exception_handler(
request: Request, exc: RequestValidationError
):
logger.warning("Validation error: {}", exc.errors())
body = exc.body
if body is not None and not isinstance(body, (dict, list, str, int, float, bool, type(None))):
body = str(body)
return JSONResponse(
status_code=422,
content={
"detail": exc.errors(),
"body": exc.body,
"body": body,
},
)