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.
Since I've emailed Rolf discussing the datasets relationship in the PaNOSC data model, I will keep #319 open. I will close it once I've got a response and we know a way forward with the data model (whether to raise it further or to follow it as it is).
Description
This PR improves the error signaling for the search API. In #319 (comment), there's a request that showed a 400. Since this is an issue with the validation of the data model, this should really be a 500. My changes fix that for Pydantic's ValidationErrors.
I've also made some general improvements - I've added
KeyError
to the tuple of standard Python exceptions to catch and moved the assignment of astatus_code
attribute into its own function (to avoid code duplication).The version bump will be a fix bump.
Testing Instructions
When using a local instance pointing at ISIS dev ICAT, the following request should return a 500 with a more meaningful error message (about the validation error):
http://{{datagateway-api}}/search-api/documents?filter={"limit": 10}&filter={ "include": [ { "relation": "members", "scope": { "where": { "role": { "neq": "principal_experimenter" } }, "include": [ { "relation": "person" } ] } }, { "relation": "datasets" } ], "limit": 1, "skip": 3
icatdb Generator Script Consistency Test
CI job fails, is this because of a deliberate change made to the script to change generated data (which isn't actually a problem) or is here an underlying issue with the changes made?fix:
,feat:
orBREAKING CHANGE:
so a release is automatically made via GitHub Actions upon merge?