fix: add helpful error messages for URL validation#943
Merged
maxachis merged 1 commit intoPolice-Data-Accessibility-Project:devfrom Feb 10, 2026
Merged
Conversation
- Add Pydantic field validator to reject URLs with fragments (#) - Handle IntegrityError to distinguish between constraint violations - Return 400 Bad Request for URLs with fragments - Return 409 Conflict for duplicate URL/record_type combinations - Add Pydantic ValidationError handling in request middleware - Add comprehensive integration tests for error cases Database check constraints (23514) and unique constraints (23505) are now caught and converted to user-friendly error messages instead of generic 500 errors. All tests passing (9/9 data source integration tests). Fixes Police-Data-Accessibility-Project#906
Contributor
|
@labradorite-dev hey, thanks for the contribution and sorry about my delay! I asked someone else to take a look at it, and update the CODEOWNERS to be more helpful in the future. He might make some stylistic suggestions, but we appreciate you following the instructions and making a useful contribution. |
b1a4fb9
into
Police-Data-Accessibility-Project:dev
4 of 5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #906
Returns proper HTTP status codes with clear error messages for:
Previously returned generic 500 errors.
All tests passing (9/9).