fix(client): raise informative error on non-404 fetch failure - #19
Merged
Conversation
get_bundles and get_bitstreams already return [] on a 404 (deleted item or bundle). On any other failure fetch_resource returns None and the code then subscripted it, surfacing an opaque 'NoneType is not subscriptable' TypeError with no status or url. Raise an explicit RuntimeError carrying the HTTP status and url instead, so a transient 5xx is a legible, retryable error. Addresses a Copilot review note; tests assert the status/url is in the message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Follow-up to #18, addressing a Copilot review note.
get_bundlesandget_bitstreamsreturn[]on a 404 (deleted item/bundle).On any other failure
fetch_resourcereturnsNoneand the code thensubscripted it, surfacing an opaque
'NoneType' object is not subscriptableTypeErrorwith no HTTP status or url. Both now raise an explicitRuntimeErrorcarrying the status + url, so a transient 5xx is a legible, retryable error
instead of a mystery crash.
Tests assert the status and url are in the message. 63 tests, no network.