Follow-up fix for InvalidAddressError messages #92
+32
−9
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.
Background
In the following Pull Request, an issue was fixed where the error message for
InvalidAddressErrordid not include the invalid IP address:This Pull Request fixes additional cases where the invalid IP address is still not shown in the
InvalidAddressErrormessage, as well as cases where the error message shows a numeric value instead of an address format.Details
Invalid address is not shown
When an invalid non-IPv4 address value is passed to
IPAddr#new,@addris not set. As a result, the error message ends up missing the invalid address.In this case, the argument (
left) passed to thein6_addrmethod, where the exception is raised, is now included in the error message.For example:
Numeric value instead of an address representation
In some cases, the address shown in the error message is a numeric value such as
42540766411282592856903984951653826560instead of a human-readable address format like2001:db8::.This Pull Request updates the error messages to display the address in a human-readable format.
For example:
The following methods are updated to improve their error messages:
#ipv4_mapped#ipv4_compat#ip6_arpa#ip6_intExpected behavior
Actual behavior