Skip to content

Commit

Permalink
fixed a few error reporting bugs in Mojo::IOLoop::Client and Mojo::IO…
Browse files Browse the repository at this point in the history
…Loop::Server (closes #503)
  • Loading branch information
kraih committed Jun 10, 2013
1 parent 8e9af4f commit 060a775
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Changes
@@ -1,4 +1,8 @@

4.15 2013-06-11
- Fixed a few error reporting bugs in Mojo::IOLoop::Client and
Mojo::IOLoop::Server.

4.14 2013-06-10
- Improved url_for performance slightly.
- Fixed bug where match attribute and render_later method were not hidden
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop/Client.pm
Expand Up @@ -56,7 +56,7 @@ sub _connect {
$options{LocalAddr} = $args->{local_address} if $args->{local_address};
$options{PeerAddr} =~ s/[\[\]]//g if $options{PeerAddr};
my $class = IPV6 ? 'IO::Socket::IP' : 'IO::Socket::INET';
return $self->emit_safe(error => "Couldn't connect")
return $self->emit_safe(error => "Couldn't connect: $@")
unless $self->{handle} = $handle = $class->new(%options);

# Timeout
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/IOLoop/Server.pm
Expand Up @@ -56,8 +56,8 @@ sub listen {
my $handle;
my $class = IPV6 ? 'IO::Socket::IP' : 'IO::Socket::INET';
if (defined $fd) {
$handle = $class->new;
$handle->fdopen($fd, 'r') or croak "Can't open file descriptor $fd: $!";
$handle = $class->new_from_fd($fd, 'r')
or croak "Can't open file descriptor $fd: $!";
}

# New socket
Expand All @@ -71,7 +71,7 @@ sub listen {
Type => SOCK_STREAM
);
$options{LocalAddr} =~ s/[\[\]]//g;
$handle = $class->new(%options) or croak "Can't create listen socket: $!";
$handle = $class->new(%options) or croak "Can't create listen socket: $@";
$fd = fileno $handle;
$ENV{MOJO_REUSE} .= length $ENV{MOJO_REUSE} ? ",$reuse:$fd" : "$reuse:$fd";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -41,7 +41,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Top Hat';
our $VERSION = '4.14';
our $VERSION = '4.15';

sub AUTOLOAD {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/user_agent_online.t
Expand Up @@ -89,7 +89,7 @@ ok $tx->error, 'has error';
$tx = $ua->build_tx(GET => 'http://cdeabcdeffoobarnonexisting.com');
$ua->start($tx);
ok $tx->is_finished, 'transaction is finished';
is $tx->error, "Couldn't connect", 'right error';
like $tx->error, qr/^Couldn't connect/, 'right error';

# Fresh user agent again
$ua = Mojo::UserAgent->new;
Expand Down

0 comments on commit 060a775

Please sign in to comment.