Provide dig exit code in CouldNotFetchDns exception - #124
Merged
Conversation
When a dig lookup fails, the exception message used to be built straight from dig's stderr. dig writes the warning `;; IDN output support not enabled` to stderr, so that warning surfaced as the error message while the actual failure signal (the non-zero exit code) was dropped entirely. As reported in discussion #123, this made failures very hard to diagnose. The exit code now leads the message, is mapped to dig's documented meaning where known, and is exposed via a readonly `$exitCode` property for programmatic inspection. dig's stderr is kept as supplementary context rather than masquerading as the cause. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the lookup constant with a dedicated method using a match expression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the PHP CS Fixer workflow with Pint, using actions that run on Node 24 (checkout@v6, laravel-pint-action@2.6, git-auto-commit@v7), resolving the Node 20 deprecation warning on the styling workflow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Why
Discussion #123 reports that when a
diglookup fails, the exception is hard to diagnose:CouldNotFetchDns::digReturnedWithError()built its message straight from dig's stderr. dig writes;; IDN output support not enabledto stderr regardless of success, so when a lookup also failed (typically a transient "no reply from server"), that unrelated warning surfaced as the error message and the real signal, the non-zero exit code, was dropped entirely.What changed
public ?int $exitCodeproperty so callers can branch on it programmatically.;; IDN output support not enabledwarning can be genuinely useful for internationalized domains, so it is demoted, not discarded.Message, before and after
Before:
After:
The
$exitCodeisnullfor the non-dig paths (noHandlerFound,dnsGetRecordReturnedWithError).