shashbha14 opened a new pull request, #62861:
URL: https://github.com/apache/airflow/pull/62861

   Fixes #62788    
   1. What's happening
     'POST /pools' wasn't returning 409 when a pool with the same name already 
existed.
     The endpoint relied on '_UniqueConstraintErrorHandler' to catch the 
'IntegrityError'
      and convert it to a 409, but that handler pattern-matches against DB 
driver error
     strings for SQLite/MySQL/Postgres. If the string doesn't match, it returns 
'None'
     silently — so the error gets swallowed and the response is unpredictable 
(seen in 3.0.6).
   2. Fix
     Added an explicit existence check in 'post_pool' before calling 
'session.add()'.
     If a pool with that name exists, we raise 'HTTPException(409)' directly — 
same
     approach 'post_variable' already uses.
    '_UniqueConstraintErrorHandler' is left untouched, it's still used by 
connections.
   
    3.Testing
   
     - 'TestPostPool::test_should_response_409' updated to match the new 
plain-string detail
     - Full 'test_pools.py' suite passes
   


-- 
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