diff --git a/backend/common/exception/exception_handler.py b/backend/common/exception/exception_handler.py index 711d3cd3a..ec28e77a7 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 )