Repository navigation
Report the HTTP status and validation errors of LiveDNS - #19
Open
n-rodriguez wants to merge 1 commit into
Open
n-rodriguez wants to merge 1 commit into
n-rodriguez wants to merge 1 commit into
Conversation
LiveDNS validation errors carry neither code nor message, only a list of errors, so they surfaced as "LiveDNS returned a 0 ()". A body that is not JSON returned the decoding error instead of the HTTP status. - Update client.go: fall back on the HTTP status code and text, append each validation error, and keep the status when the body is not JSON - Update gandi.go: read the error location from its "location" key - Add errors_test.go: cover validation errors, code and message, and a non-JSON body Co-Authored-By: Claude Opus 5.5 <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.
Problem
LiveDNS validation errors carry neither
codenormessage, only a list of errors:{"status": "error", "errors": [{"location": "body", "name": "items", "description": "String does not match expected pattern"}]}doRequestonly reportedcodeandmessage, so such an error surfaced asLiveDNS returned a 0 (), with nothing to tell what was rejected. A body that is not JSON (a 403 page from a gateway, for instance) returned the JSON decoding error (invalid character '<' looking for beginning of value) instead of the HTTP status. TheLocationfield ofgandiErrorswas also read from abodykey, while LiveDNS sends it aslocation.Change
code, and on the HTTP status text when it has nomessage; the returned status carries that code too, so callers checking for a 404 keep working.LiveDNS returned a 400 (Bad Request): body items: String does not match expected pattern.LiveDNS returned a 403 (Forbidden).Locationfrom thelocationkey.Tests
errors_test.gocovers a validation error, an error with code and message (unchanged behaviour), and a non-JSON body. The validation and non-JSON tests fail without the change, and the validation test also fails with the formerbodytag.This is independent from #18; both touch
client.goin different functions.🤖 Generated with Claude Code