mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-10-22 09:28:42 +00:00
12 lines
401 B
Python
12 lines
401 B
Python
from fastapi import Request
|
|
from fastapi.exceptions import RequestValidationError
|
|
|
|
from dbgpt.app.openapi.api_view_model import Result
|
|
|
|
|
|
async def validation_exception_handler(request: Request, exc: RequestValidationError):
|
|
message = ""
|
|
for error in exc.errors():
|
|
message += ".".join(error.get("loc")) + ":" + error.get("msg") + ";"
|
|
return Result.failed(code="E0001", msg=message)
|