ferruzzi commented on code in PR #52838:
URL: https://github.com/apache/airflow/pull/52838#discussion_r2185781060


##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/base_aws.py:
##########
@@ -623,19 +623,16 @@ def conn_config(self) -> AwsConnectionWrapper:
         """Get the Airflow Connection object and wrap it in helper (cached)."""
         connection = None
         if self.aws_conn_id:
-            possible_exceptions: tuple[type[Exception], ...]
-
-            if AIRFLOW_V_3_0_PLUS:
-                possible_exceptions = (AirflowNotFoundException, 
AirflowRuntimeError)
-            else:
-                possible_exceptions = (AirflowNotFoundException,)
-
             try:
                 connection = self.get_connection(self.aws_conn_id)
-            except possible_exceptions as e:
-                if isinstance(
-                    e, AirflowNotFoundException
-                ) or f"Connection with ID {self.aws_conn_id} not found" in 
str(e):
+            except Exception as e:
+                not_found_exc_via_core = isinstance(e, 
AirflowNotFoundException)
+                not_found_exc_via_task_sdk = (
+                    AIRFLOW_V_3_0_PLUS
+                    and isinstance(e, AirflowRuntimeError)
+                    and e.error.error == ErrorType.CONNECTION_NOT_FOUND
+                )
+                if not_found_exc_via_core or not_found_exc_via_task_sdk:

Review Comment:
   I was thinking we shouldn't make a change to core to accommodate how we were 
handling it in the provider, but if you think this is an indicator that maybe 
core can be cleaned up, I can see that and I certainly won't argue with you.  
Thanks



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