Skip to content

Commit 43d5389

Browse files
committed
more handler
1 parent 516a31d commit 43d5389

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

template/{% if has_backend %}backend{% endif %}/src/backend_api/fast_api_exception_handlers.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ def _problem_dict(
4343
trace_id: str,
4444
exc_type: str,
4545
) -> dict[str, Any]:
46-
body: dict[str, Any] = {
47-
"type": "about:blank",
48-
"title": title,
49-
"status": status,
50-
"detail": detail,
51-
"instance": f"urn:uuid:{trace_id}",
52-
"errorType": exc_type,
53-
}
54-
return body
46+
return ProblemDetails(
47+
type="about:blank",
48+
title=title,
49+
status=status,
50+
detail=detail,
51+
instance=f"urn:uuid:{trace_id}",
52+
errorType=exc_type,
53+
).model_dump(by_alias=True, mode="json")
5554

5655

5756
def handle_http_exception(request: Request, exc: Exception) -> JSONResponse:

0 commit comments

Comments
 (0)