SreeramaYeshwanthGowd commented on PR #70237:
URL: https://github.com/apache/airflow/pull/70237#issuecomment-5049099129

   @bugraoz93 Thanks! Quick clarification on the mechanism: passing a plain 
string to Pydantic's `ValidationError` (`raise ValidationError("...")`) 
actually raises `TypeError`, not a validation error, because the class expects 
`line_errors`. Nothing handles that `TypeError`, so the response comes back as 
`500` instead of `422`. Since the real error is a `TypeError` and not a 
`ValidationError`, a central `ValidationError` handler would not catch these. 
Switching to `raise ValueError` fixes it, and FastAPI already adds `422` to the 
OpenAPI docs on its own (see `create_openapi_http_exception_doc`).
   
   I also checked the tree, and the only other place using this pattern is 
`services/public/connections.py:162`, which is currently unreachable, so there 
is nothing else to fix here.
   
   Would appreciate another look when you get a chance. Thanks again!
   
   ---
   Drafted-by: Claude Code (Opus 4.8); reviewed by @SreeramaYeshwanthGowd 
before posting
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to