Repository navigation
Conversation
Move the five 429 cases from MetadataService.test.ts to the getJson tests, where the behaviour lives, and assert the error class. Give ErrorHttpResponse the same "Marker to detect class" name field as ErrorTimeout and ErrorDPoPNonce, and document that callers should read response.status and that the response cannot be cloned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017JuHv1wUFSRq7LQyDkjuC9
This branch has not been deployed
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.
When discovery returns HTTP 429, applications need the status and Retry-After header to schedule the next attempt. A gateway can send plain text or an empty body. Parsing the exception message then loses the status or the cooldown.
This change exposes the original Fetch response on failures from JSON GET requests. Generic HTTP failures throw the exported ErrorHttpResponse. An OAuth error document still throws ErrorResponse, so existing
catchblocks keep working; it carries the response on a property of the same name, so a caller can readerror.responsewithout checking which class it caught. Existing error messages are preserved, including "Invalid response Content-Type" for a non-JSON reply, so readresponse.statusrather than the message. The response cannot pass throughstructuredCloneorpostMessage.Scope: this covers
getJsononly.postForm(the token endpoint) still throws a plainErrorfor these cases and is left for a follow-up. The new thirdErrorResponseparameter sits afterformso that follow-up can pass both.Five regression cases in
JsonService.test.tsexercisegetJson()with plain text, malformed JSON, an empty object, JSON null and an OAuth error document. They check the message, the error class and the identity of the response. The full test suite, lint and package build pass.