Files
rengine/api/app/core/validation_errors.py
T
Yogesh OjhaandClaude Fable 5.1 0a69f3201c copy: state the fact, delete the explanation
Repo-wide sweep of every user-facing string: frontend components, routes,
config and stores; API details and route docs; shared definitions and
models; stage config help; report prose; MCP, toolbox, interest and
connector text; notification and worker messages.

Descriptions that explained, reassured, justified or restated their title
are deleted. Confirm dialogs name what is removed and stop. Failed actions
read "<Noun> not <verbed>", successes "<Noun> <verbed>". No reader address,
no product-as-subject, no em-dashes or parentheticals in prose.

Mirrors updated on both sides: EPSS band help, compare refusal reasons,
interest labels. Four tests asserting on old wording follow the new text.
The rules are condensed into CLAUDE.md under Writing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SK5o8xR96cbSnAfjYSTPSe
2026-09-12 11:35:07 +05:30

27 lines
794 B
Python

"""Validation errors without the echoed input."""
from fastapi import Request
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY
def _part(value: object) -> str | int:
return value if isinstance(value, str | int) else str(value)
async def validation_error_handler(
_request: Request, exc: RequestValidationError
) -> JSONResponse:
detail = [
{
"type": str(error.get("type", "")),
"loc": [_part(part) for part in error.get("loc", ())],
"msg": str(error.get("msg", "")),
}
for error in exc.errors()
]
return JSONResponse(
status_code=HTTP_422_UNPROCESSABLE_ENTITY, content={"detail": detail}
)