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

🦺 Make sure code for fetching details pages handles missing information gracefully #21

Closed
MatMoore opened this issue Mar 28, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@MatMoore
Copy link
Contributor

MatMoore commented Mar 28, 2024

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 any KeyError 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.

@MatMoore MatMoore added the bug Something isn't working label Mar 28, 2024
@MatMoore MatMoore transferred this issue from ministryofjustice/analytical-platform Apr 2, 2024
@seanprivett seanprivett moved this to Todo in Data Catalogue Apr 11, 2024
@LavMatt LavMatt self-assigned this Apr 12, 2024
@LavMatt LavMatt moved this from Todo to In Progress in Data Catalogue Apr 17, 2024
@LavMatt LavMatt moved this from In Progress to Blocked in Data Catalogue Apr 18, 2024
@LavMatt
Copy link
Contributor

LavMatt commented Apr 18, 2024

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

@LavMatt
Copy link
Contributor

LavMatt commented Apr 19, 2024

Actually this is now all likely to be covered within the wider refactor

@murdo-moj murdo-moj moved this from Blocked to Todo in Data Catalogue May 1, 2024
@hjribeiro-moj hjribeiro-moj moved this from Todo to In Progress in Data Catalogue May 3, 2024
@YvanMOJdigital YvanMOJdigital moved this from In Progress to Review in Data Catalogue May 9, 2024
@murdo-moj
Copy link
Contributor

ministryofjustice/find-moj-data#327 fixing this bug is the parent problem of this particular bug

@hjribeiro-moj
Copy link
Contributor

After review we decided to close ticket as graphql_helper is defensive enough. Is any KeyError is raised and seen on alerts, we can fix those particular instances.

@github-project-automation github-project-automation bot moved this from Review to Done in Data Catalogue May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done ✅
Development

No branches or pull requests

4 participants