Repository navigation
UniqueConstraintViolationError #18486
grazianodev
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Right now, when a unique constraint violation occurs, Payload surfaces it as a generic ValidationError. The only way to determine that the error is specifically a unique constraint violation is to inspect the error message and check whether it is "Value must be unique".
I think relying on the error message for this is fragile and makes it difficult to handle unique constraint violations reliably. I’d prefer a more specialized UniqueConstraintViolationError that would allow consumers to distinguish these errors programmatically and handle them appropriately.
All reactions