cmd error parsing: show a "try again after" message when a response sets a Retry-After header#1198
Merged
ErikSchierboom merged 1 commit intoexercism:mainfrom Jun 19, 2025
Conversation
…ets a Retry-After header
There was a problem hiding this comment.
Pull Request Overview
This PR updates error response handling to display a "try again after" message when an API returns a Retry-After header, and refines test helpers for different error status codes.
- Renames the existing error response helper to errorResponse418 for 418 errors.
- Adds a new error response helper errorResponse429 for 429 responses with a Retry-After header.
- Updates decodedAPIError to check for and appropriately format the Retry-After header in error messages.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/cmd_test.go | Updated helper functions and tests to simulate 418 and 429 responses. |
| cmd/cmd.go | Added logic in decodedAPIError to format Retry-After values in errors. |
Comments suppressed due to low confidence (1)
cmd/cmd.go:85
- Consider adding a brief comment here clarifying that if the Retry-After header cannot be parsed as an integer, its value is assumed to be a pre-formatted HTTP date.
if retryAfter := resp.Header.Get("Retry-After"); retryAfter != "" {
Member
|
Looks good to me. Thank you. I'd like another pair of eyes before merging though |
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.
No description provided.