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

Cryptic error message on unique_together error when using DjangoPatchMutation #104

Open
chdefrene opened this issue Jan 17, 2023 · 0 comments

Comments

@chdefrene
Copy link

I have a model with a unique_together constraint:

# users/models.py

class Person(models.Model):
    class Meta:
        unique_together = ("first_name", "last_name")

However, when I add a DjangoPatchMutation for this model, and then try to patch an object that triggers the uniqueness constraint, the following error is returned:

graphql.error.located_error.GraphQLLocatedError: current transaction is aborted, commands ignored until end of transaction block

This makes it hard to handle error messages in my app.

For comparison, this is the error that is returned when the same constraint is triggered by DjangoCreateMutation:

duplicate key value violates unique constraint "users_person_first_name_last_name_uniq"
     DETAIL:  Key (first_name, last_name)=(John, Crichton) already exists."
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

No branches or pull requests

1 participant