Skip to content

Replace AirflowException with ValueError in ProduceToTopicOperator - #70351

Open
FrankYang0529 wants to merge 1 commit into
apache:mainfrom
FrankYang0529:airflow-70296-kafka
Open

Replace AirflowException with ValueError in ProduceToTopicOperator#70351
FrankYang0529 wants to merge 1 commit into
apache:mainfrom
FrankYang0529:airflow-70296-kafka

Conversation

@FrankYang0529

@FrankYang0529 FrankYang0529 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Based on CLAUDE.md, the community is actively reducing AirflowException usage. Replace raise AirflowException(...) with raise ValueError(...) in ProduceToTopicOperator.


Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Apparently #70333 was opened earlier and addresses the problem more precisely.
One thing in mind - here you tried to address two issues in one PR (validate_operators_init_exemption.txt + known_airflow_execptions) - I prefer to handle each separtely.

Feel free to tackle the other operators (there are still plenty), or to turn this PR into addressing the known_airflow_exceptions part once the other is merged.

@FrankYang0529

Copy link
Copy Markdown
Member Author

I will turn this one into addressing the known_airflow_exceptions part after #70333 is merged.

@FrankYang0529 FrankYang0529 changed the title Move ProduceToTopicOperator template-field validation into execute Replace AirflowException with ValueError in ProduceToTopicOperator Jul 25, 2026

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We might need to take an intermediate step of creating an exception class that derives from both AirflowException and ValueError, because it will break the retry mechanism that is based on detecting the exception type.
It had been discussed in the past but was put on hold, I'll try to revive this discussion.

Signed-off-by: PoAn Yang <payang@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants