Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Prettier "Can't connect" message in response

  • Loading branch information...
commit 04810a0363777d607b0b7fd0471d452da6eacfc5 1 parent 20563d0
Gisle Aas authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/LWP/Protocol/http.pm
10 lib/LWP/Protocol/http.pm
View
@@ -40,8 +40,14 @@ sub _new_socket
unless ($sock) {
# IO::Socket::INET leaves additional error messages in $@
- $@ =~ s/^.*?: //;
- die "Can't connect to $host:$port ($@)";
+ my $status = "Can't connect to $host:$port";
+ if ($@ =~ /\bconnect: (.*)/ ||
+ $@ =~ /\b(Bad hostname)\b/ ||
+ $@ =~ /\b(certificate verify failed)\b/
+ ) {
+ $status .= " ($1)";
+ }
+ die "$status\n\n$@";
}
# perl 5.005's IO::Socket does not have the blocking method.
Please sign in to comment.
Something went wrong with that request. Please try again.