Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more detailed error message if constructor fails #26

Merged
merged 1 commit into from Mar 1, 2024

Conversation

mm-david
Copy link
Contributor

@mm-david mm-david commented Feb 29, 2024

Currently, if socket construction fails, the exception uses the message in $!. Because this error message comes from the last system call, it has less information that the specific message in $IO::Socket::errstr.

I recommend changing to use $IO::Socket::errstr to populate the exception if the socket cannot be created.

From the docs of IO::Socket::IP:

If the constructor fails, it will set $IO::Socket::errstr and $@ to an appropriate error message; this may be from $! or it may be some other string.

As an example, if the domain name of a WHOIS server cannot be resolved (e.g. whois.tonic.to), the message in $! is Invalid argument, whereas $IO::Socket::errstr is Name or service not known. The latter indicates a DNS error, whereas the former is difficult to understand.

@nalobin nalobin merged commit 9f7da36 into regru:master Mar 1, 2024
@mm-david
Copy link
Contributor Author

@nalobin would it be possible to make a new release for CPAN with this change? I know it's quite minor, but it would be much appreciated.

@nalobin
Copy link
Member

nalobin commented Apr 16, 2024

Hello. Just uploaded Net-Whois-Raw-2.99039.tar.gz to CPAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants