Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
from airflow.providers.amazon.aws.utils.identifiers import generate_uuid
from airflow.providers.amazon.aws.utils.suppress import return_on_error
from airflow.providers.amazon.version_compat import BaseHook
from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_0_PLUS
from airflow.providers_manager import ProvidersManager
from airflow.utils.helpers import exactly_one
from airflow.utils.log.logging_mixin import LoggingMixin
Expand All @@ -77,9 +76,6 @@
BaseAwsConnection = TypeVar("BaseAwsConnection", bound=Union[BaseClient, ServiceResource]) # noqa: UP007


if AIRFLOW_V_3_0_PLUS:
from airflow.sdk.exceptions import AirflowRuntimeError, ErrorType

if TYPE_CHECKING:
from aiobotocore.session import AioSession
from botocore.client import ClientMeta
Expand Down Expand Up @@ -621,19 +617,12 @@ def conn_config(self) -> AwsConnectionWrapper:
if self.aws_conn_id:
try:
connection = self.get_connection(self.aws_conn_id)
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
except AirflowNotFoundException:
self.log.warning(
"Unable to find AWS Connection ID '%s', switching to empty.", self.aws_conn_id
)
if not_found_exc_via_core or not_found_exc_via_task_sdk:
self.log.warning(
"Unable to find AWS Connection ID '%s', switching to empty.", self.aws_conn_id
)
else:
raise
except Exception:
raise

return AwsConnectionWrapper(
conn=connection,
Expand Down
Loading