kalluripradeep commented on code in PR #64418:
URL: https://github.com/apache/airflow/pull/64418#discussion_r3033948649


##########
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/login.py:
##########
@@ -37,6 +39,13 @@
     get_cookie_path = lambda: "/"
 
 
+def _get_flask_app():
+    auth_manager = cast("FabAuthManager", get_auth_manager())
+    if not auth_manager.flask_app:
+        raise RuntimeError("Flask app must be initialized")
+    return auth_manager.flask_app

Review Comment:
   Done. Replaced `cast` with an `isinstance` check so if the wrong auth 
manager is configured you get a clear HTTP 500 with a descriptive message 
instead of an `AttributeError`. Also switched from `RuntimeError` to 
`HTTPException` so FastAPI handles it properly.



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