Repository navigation
Throw ArgumentException for a malformed baseUrl, as documented - #4
Merged
dmccoystephenson merged 1 commit intoOct 3, 2026
Merged
Conversation
new Uri throws UriFormatException, a FormatException rather than an ArgumentException, so a caller catching the documented ArgumentException missed it. Wrap it, keeping the original as the inner exception. Closes #3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dmccoystephenson
force-pushed
the
feature/malformed-baseurl-argumentexception
branch
from
September 30, 2026 07:33
45c6b6c to
a662e9b
Compare
Member
Author
|
Self-review rubric (head
Judgment calls and out-of-diff observations:
This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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.
Summary
ArgumentExceptionfor a "missing or malformedbaseUrl". A missing one did, but a malformed one got out ofnew Uri(...)asUriFormatException, which is aFormatExceptionand not anArgumentException. A caller catching the documented type missed it.new Uri(...)call is now wrapped.UriFormatExceptionis rethrown asArgumentException("baseUrl is not a valid URL", "baseUrl", inner), which matches the sibling precondition messages and keeps the original asInnerException.Constructor_RejectsAMalformedBaseUrlWithAnArgumentException. It checks the exact type (Assert.Throws<ArgumentException>does not accept subtypes),ParamNameand the innerUriFormatException.Closes #3
Test plan
Buildworkflow green on ubuntu-latest (net8.0) and windows-latest (net8.0 + net48)dotnetSDK was available in the drafting sandbox)Notes for the reviewer
UriFormatExceptionor onlyArgumentExceptionis arguably part of the public contract. This change makes the code follow the documented contract instead of changing that contract. It still needs a maintainer's review before merge.Skipped issues: none. There were no other open issues at triage time.
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson
🤖 Generated with Claude Code