-
Notifications
You must be signed in to change notification settings - Fork 43
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
Creating a new Team with the same name should not propagate IntegrityError #934
base: main
Are you sure you want to change the base?
Conversation
…gate IntegrityError
@msmagnanijr I feel we should not add this specific uniqueness constraint validation in Team serialization, otherwise we would need to do the same for every serialization that has a uniqueness constraint field (or joint fields). Let's find out why only this one yields a 500 error. How do others handle django.db.utils.IntegrityError? |
@@ -57,6 +57,9 @@ class Meta: | |||
|
|||
def validate(self, data): | |||
self.validate_shared_resource() | |||
validators.check_if_team_name_exists( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msmagnanijr When this resource gets managed in the Gateway does it follow the same constraints?
@msmagnanijr Because in the serializer we introduce Since we will continue to use
The response will be a 400 error with data |
@bzwei @msmagnanijr We could also add the following in
which would return the 400 error message @bzwei mentioned above:
|
@Dostonbek1 @bzwei thanks! I'll work on it now and ask for a new review. |
When attempting to create a team with the same name as an existing team within the same organization, the API currently returns a HTTP 500 error. While this correctly identifies this, the error handling can be improved to provide a more user-friendly response.