Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIP-84 Refactor Handling of Insert Duplicates for Post Connection #44322

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jason810496
Copy link
Contributor

@jason810496 jason810496 commented Nov 24, 2024

related: #44121 (comment)

It seems that only the Post Connection endpoint has an extra query to handle duplicate entries. Other 409_CONFLICT cases don't handle inserting duplicate entries on unique constraint columns.

assert response.json() == {
"detail": f"Connection with connection_id: `{TEST_CONN_ID}` already exists",
}
assert response.json() == {"detail": "Unique constraint violation"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we subclass the global exception handler to add personalized messages? 'Unique constraint violation' is quite broad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is possible to include error details (e.g., str(e)) to provide a more descriptive message. However, I can't think of a way to include custom error messages specific to each router, as the error handler is registered at the app level rather than the router level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants