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

refactor: do not swallow non-backend errors in datasets() #85

Merged
merged 7 commits into from
Mar 19, 2025

Conversation

mortenpi
Copy link
Member

@mortenpi mortenpi commented Mar 12, 2025

datasets() will filter out any dataset JSON objects it can not parse, just to gracefully degrade when there is something weird in the backend response, but only for some datasets. However, currently it also hides e.g. any coding errors in the Dataset() constructor, because we catch things unconditionally.

This changes Dataset to consistently throw JuliaHubError when it encounters a backend response it can not parse, and datasets() will then only filter those datasets. Any other errors will get rethrown, making datasets() itself throw, directly exposing non-backend issues to the caller.

It also adds direct test coverage on the error handling in Dataset(::Dict) calls, which in turn required some slightly refactoring of the mocking code (to reuse the bit that constructs the dataset JSON objects).

@mortenpi mortenpi requested a review from a team March 12, 2025 06:24
@mortenpi mortenpi enabled auto-merge (squash) March 12, 2025 06:26
@mortenpi mortenpi merged commit 5a52b02 into main Mar 19, 2025
13 checks passed
@mortenpi mortenpi deleted the mp/dataset-constructor-tests branch March 19, 2025 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants