File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,14 @@ async def _validation_exception_handler(exc: RequestValidationError | Validation
4646 if i18n .current_language != 'en-US' :
4747 custom_message = t (f'pydantic.{ error ["type" ]} ' )
4848 if custom_message :
49- ctx = error .get ('ctx' )
50- if not ctx :
49+ error_ctx = error .get ('ctx' )
50+ if not error_ctx :
5151 error ['msg' ] = custom_message
5252 else :
53- ctx_error = ctx .get ('error' )
54- if ctx_error :
55- error ['msg' ] = custom_message .format (** ctx )
56- error ['ctx' ]['error' ] = (
57- ctx_error .__str__ ().replace ("'" , '"' ) if isinstance (ctx_error , Exception ) else None
58- )
53+ e = error_ctx .get ('error' )
54+ if e :
55+ error ['msg' ] = custom_message .format (** error_ctx )
56+ error ['ctx' ]['error' ] = e .__str__ ().replace ("'" , '"' ) if isinstance (e , Exception ) else None
5957 errors .append (error )
6058 error = errors [0 ]
6159 if error .get ('type' ) == 'json_invalid' :
You can’t perform that action at this time.
0 commit comments