-
Notifications
You must be signed in to change notification settings - Fork 161
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
FIX: Improved error message in the case of SQL constraint violation on foreign keys #4167
base: develop
Are you sure you want to change the base?
FIX: Improved error message in the case of SQL constraint violation on foreign keys #4167
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4167 +/- ##
==========================================
Coverage 16.71% 16.71%
Complexity 22 22
==========================================
Files 2039 2041 +2
Lines 53018 53036 +18
Branches 4453 4455 +2
==========================================
+ Hits 8860 8867 +7
- Misses 43755 43766 +11
Partials 403 403
|
7f5d201
to
4ee9ece
Compare
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.
Changes are ok, but the fact that it would be better if that was a generic exception that does not strictly relates to SQL and Foreign Keys.
KapuaIntegrityConstraintViolationException
with message Entity constraint violation error. This entity relates to other entities and cannot be deleted.
… SQL integrity constraint violation exceptions
…upport different datastores scenario and changed related tests
89ed3e9
to
933a0f5
Compare
Brief description of the PR.
I wanted to return a more specific error message that notifies clients that they are trying to break a fk constraints, to let them know precisely what they are doing wrong. Currently, in such cases, a too general 500 internal persistence error is returned
Description of the solution adopted
With these changes, a 409 error is returned instead, with a message that notifies precisely a fk violation if it's detected. Otherwise, a more general error message is returned if other SQL constraint violations are present