From 1f8687155a556f125eec4c57adb0acdd9ef5a33d Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Tue, 5 Aug 2025 18:11:02 +0800 Subject: [PATCH] Fix message format in validation exception handler (#755) --- backend/common/exception/exception_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/common/exception/exception_handler.py b/backend/common/exception/exception_handler.py index 711d3cd..ec28e77 100644 --- a/backend/common/exception/exception_handler.py +++ b/backend/common/exception/exception_handler.py @@ -52,9 +52,9 @@ async def _validation_exception_handler(request: Request, exc: RequestValidation if not ctx: error['msg'] = custom_message else: - error['msg'] = custom_message.format(**ctx) ctx_error = ctx.get('error') if ctx_error: + error['msg'] = custom_message.format(**ctx) error['ctx']['error'] = ( ctx_error.__str__().replace("'", '"') if isinstance(ctx_error, Exception) else None )