Skip to content

Commit

Permalink
use smart match for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 17, 2011
1 parent d045691 commit c26f9b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/IOLoop/Stream.pm
Expand Up @@ -86,7 +86,7 @@ sub _read {
unless (defined $read) {

# Retry
return if $! == EAGAIN || $! == EINTR || $! == EWOULDBLOCK;
return if $! ~~ [EAGAIN, EINTR, EWOULDBLOCK];

# Closed
return $self->emit_safe('close') if $! == ECONNRESET;
Expand Down Expand Up @@ -114,10 +114,10 @@ sub _write {
unless (defined $written) {

# Retry
return if $! == EAGAIN || $! == EINTR || $! == EWOULDBLOCK;
return if $! ~~ [EAGAIN, EINTR, EWOULDBLOCK];

# Closed
return $self->emit_safe('close') if $! == ECONNRESET || $! == EPIPE;
return $self->emit_safe('close') if $! ~~ [ECONNRESET, EPIPE];

# Write error
return $self->emit_safe(error => $!);
Expand Down

0 comments on commit c26f9b0

Please sign in to comment.