-
Notifications
You must be signed in to change notification settings - Fork 0
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
🦺 Make sure code for fetching details pages handles missing information gracefully #21
Comments
Will be better doing this post refactor now that has started And this will also look to address bug where methods return search results even when a given urn does not exist |
Actually this is now all likely to be covered within the wider refactor |
ministryofjustice/find-moj-data#327 fixing this bug is the parent problem of this particular bug |
After review we decided to close ticket as graphql_helper is defensive enough. Is any |
Describe the bug.
We recently had a bug where
get_table_details
threw a KeyError that prevented the page from loading.This is now fixed, but in general if expected metadata is missing, it would be better to continue to render the rest of the page (perhaps with a warning about the missing data)
To prevent this from happening again, we should ensure that our GraphQL response parsing code (mainly
graphql_helpers.py
) handles any missing data by returning some kind of empty value (e.g. None, empty list, empty dictionary).When we parse nested values (e.g.
ownership.owners.owner
) we should make sure that we catch anyKeyError
on any of the intermediate keys, and return the empty value in that case.When these errors happen, we should make sure we log them as errors so we can still debug the issue (see ministryofjustice/find-moj-data#216)
In the frontend templates, we can use conditionals or the default filter to change what we display if data is missing.
The text was updated successfully, but these errors were encountered: