Skip to content

Commit

Permalink
added more details to the exception handling recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 10, 2014
1 parent f35376d commit 4b27b60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/Mojo/IOLoop/Stream.pm
Expand Up @@ -123,8 +123,7 @@ sub _write {
if (length $self->{buffer}) {
my $written = $handle->syswrite($self->{buffer});
return $self->_error unless defined $written;
$self->emit(write => substr($self->{buffer}, 0, $written, ''));
$self->_again;
$self->emit(write => substr($self->{buffer}, 0, $written, ''))->_again;
}

$self->emit('drain') if !length $self->{buffer};
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -522,8 +522,9 @@ shouldn't block for too long.

Since timers and other non-blocking operations are running solely in the event
loop, outside of the application, exceptions that get thrown in callbacks
can't get caught and handled automatically, you can change that by subscribing
to the event L<Mojo::Reactor/"error">.
can't get caught and handled automatically. But you can handle them manually
by subscribing to the event L<Mojo::Reactor/"error"> or catching them inside
the callback.

use Mojolicious::Lite;
use Mojo::IOLoop;
Expand Down

0 comments on commit 4b27b60

Please sign in to comment.