Skip to content

Conversation

@ramitkataria
Copy link
Contributor

After #54299, there was a bit of except handling left over that appears to be redundant. It looks functionally equivalent to not having the additional handling.

Another approach I was thinking about was to add a log.exception in the except Exception block and not actually raise the exception 🤔 I'm open to any of the 2 approaches


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

After apache#54299, there was a bit of except handling left over that appears
to be redundant. It looks functionally equivalent to not having the
additional handling.
Copy link
Contributor

@ferruzzi ferruzzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something here, I think this is correct, that appears to be redundant.

Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I thought I had added a log.exception there. I think that would be a better thing to do

@potiuk potiuk merged commit d2c0ecc into apache:main Aug 15, 2025
77 checks passed
@ramitkataria ramitkataria deleted the ramitkataria/aws-redundant-except-raise branch August 15, 2025 21:23
@ramitkataria
Copy link
Contributor Author

@amoghrajesh I thought about it more and realized that there's a case where replacing raise with log.exception could do more harm than good: if the user specifies an aws_conn_id and some error occurred in airflow that raised an exception while fetching the connection, it would switch to using boto fallback credentials, just like the case where no aws_conn_id is specified. This could cause some operation to occur in an AWS account/role different from what the user intended. So I think the merged change is good and it keeps the behaviour consistent with earlier versions

@amoghrajesh
Copy link
Contributor

Sounds good in that case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants