Skip to content

Instantly share code, notes, and snippets.

/error.diff Secret

Created November 5, 2014 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/bf162003138515860ca9 to your computer and use it in GitHub Desktop.
Save anonymous/bf162003138515860ca9 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojo/IOLoop/Client.pm b/lib/Mojo/IOLoop/Client.pm
index f349873..9ce3cbc 100644
--- a/lib/Mojo/IOLoop/Client.pm
+++ b/lib/Mojo/IOLoop/Client.pm
@@ -81,7 +81,8 @@ sub _ready {
my $handle = $self->{handle};
return $! == EINPROGRESS ? undef : $self->emit(error => $!)
if $handle->isa('IO::Socket::IP') && !$handle->connect;
- return $self->emit(error => $! = $handle->sockopt(SO_ERROR))
+ return $self->emit(error => ($! ||= $handle->sockopt(SO_ERROR))
+ || "Can't connect")
unless $handle->connected;
# Disable Nagle's algorithm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment