Skip to content

Factor out a shared base for the database error handlers#68512

Merged
pierrejeambrun merged 1 commit into
apache:mainfrom
1fanwang:refactor/db-error-handler-base
Jun 15, 2026
Merged

Factor out a shared base for the database error handlers#68512
pierrejeambrun merged 1 commit into
apache:mainfrom
1fanwang:refactor/db-error-handler-base

Conversation

@1fanwang

@1fanwang 1fanwang commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Cleanup requested in review on #66888: _UniqueConstraintErrorHandler and DataErrorHandler carried near-identical bodies — the lookup id, statement log, [api] expose_stacktrace gating, and HTTPException detail shape were copied between them.

This moves that shared body into a _DatabaseErrorHandler base, leaving each handler to declare only what differs: its status_code, its reason, and an optional _should_handle guard. The unique-constraint handler keeps its per-dialect match as that guard; DataErrorHandler always handles.

No behavior change — same statuses, payloads, and expose_stacktrace gating; the existing TestUniqueConstraintErrorHandler / TestDataErrorHandler suites are untouched and pass.

related: #66888

_UniqueConstraintErrorHandler and DataErrorHandler carried near-identical
bodies — lookup id, statement log, [api] expose_stacktrace gating, and the
HTTPException detail shape. Move the shared body into a _DatabaseErrorHandler
base; each handler now declares only its status_code, reason, and an optional
_should_handle guard. No behavior change.

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. LGTM overall.

Comment thread airflow-core/src/airflow/api_fastapi/common/exceptions.py

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks

@pierrejeambrun pierrejeambrun merged commit d0ced93 into apache:main Jun 15, 2026
77 checks passed
pgagnon pushed a commit to pgagnon/airflow that referenced this pull request Jun 15, 2026
_UniqueConstraintErrorHandler and DataErrorHandler carried near-identical
bodies — lookup id, statement log, [api] expose_stacktrace gating, and the
HTTPException detail shape. Move the shared body into a _DatabaseErrorHandler
base; each handler now declares only its status_code, reason, and an optional
_should_handle guard. No behavior change.
imrichardwu pushed a commit to imrichardwu/airflow that referenced this pull request Jun 16, 2026
_UniqueConstraintErrorHandler and DataErrorHandler carried near-identical
bodies — lookup id, statement log, [api] expose_stacktrace gating, and the
HTTPException detail shape. Move the shared body into a _DatabaseErrorHandler
base; each handler now declares only its status_code, reason, and an optional
_should_handle guard. No behavior change.
dingo4dev pushed a commit to dingo4dev/airflow that referenced this pull request Jun 16, 2026
_UniqueConstraintErrorHandler and DataErrorHandler carried near-identical
bodies — lookup id, statement log, [api] expose_stacktrace gating, and the
HTTPException detail shape. Move the shared body into a _DatabaseErrorHandler
base; each handler now declares only its status_code, reason, and an optional
_should_handle guard. No behavior change.
RulerChen pushed a commit to RulerChen/airflow that referenced this pull request Jun 16, 2026
_UniqueConstraintErrorHandler and DataErrorHandler carried near-identical
bodies — lookup id, statement log, [api] expose_stacktrace gating, and the
HTTPException detail shape. Move the shared body into a _DatabaseErrorHandler
base; each handler now declares only its status_code, reason, and an optional
_should_handle guard. No behavior change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants