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

Invalid @Check Instances Should Throw ConstraintViolationException Instead of DriverException #2836

Closed
slcrider opened this issue Feb 28, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@slcrider
Copy link

Is your feature request related to a problem? Please describe.
Mikro ORM v5 added the @Check decorator. When adding @Check instances to my app and writing tests, I noticed that when a check is invalid, the lower-level DriverException is being thrown. Given that Postgres defines checks as a form of constraint, I would have expected the more-granular ConstraintViolationException to be thrown.

Describe the solution you'd like
Invalid Postgres checks throw the more specific ConstraintViolationException. Alternatively, they could get an even-more-granular exception CheckConstrainViolationException, but Postgres defines checks as the most generic constraint type, so I don't see a huge need for this.

Additional context
I am using Mikro ORM 5.0.5.

@slcrider slcrider added the enhancement New feature or request label Feb 28, 2022
@B4nan
Copy link
Member

B4nan commented Mar 2, 2022

PR welcome, this should be just a one liner.

@B4nan B4nan added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 2, 2022
@B4nan B4nan closed this as completed in ebcbdff Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants