mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-23 20:26:15 +00:00
Co-authored-by: 夏姜 <wenfengjiang.jwf@digital-engine.com> Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: wb-lh513319 <wb-lh513319@alibaba-inc.com> Co-authored-by: csunny <cfqsunny@163.com>
14 lines
494 B
Python
14 lines
494 B
Python
from fastapi import Request
|
|
from fastapi.exceptions import RequestValidationError
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from dbgpt._private.pydantic import model_to_dict
|
|
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)
|