Skip to content

return in finally can swallow exceptions #43274

@iritkatriel

Description

@iritkatriel

Apache Airflow version

main (development)

If "Other Airflow 2 version" selected, which one?

No response

What happened?

In a few places in the code, you have a return statement in a finally block which would swallow any in-flight exception:

return self.check_query_status(query_execution_id)

return dynamodb_hook.get_conn().Table(self.dynamodb_table_name).table_arn

This means that if an unhandled exception (like a BaseException such as KeyboardInterrupt) is raised from the try body, or any exception is raised from an except: clause, it will not propagate on as expected.

See also https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions.

What you think should happen instead?

No response

How to reproduce

This is from analysis of the source code.

Operating System

All

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions