Permalink
Browse files

Merge pull request #3 from kamholz/master

make error handling possible
  • Loading branch information...
2 parents 84986a9 + f92bb5e commit 8330c5437a66a84b8b8d41fdce232704e6492e57 @substack committed Oct 9, 2014
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/DNode.pm
View
@@ -68,6 +68,15 @@ sub _handle {
my ($self, $fh, $block, $kwargs) = @_;
my $handle = new AnyEvent::Handle(
fh => $fh,
+ on_error => sub {
+ my ($handle, $fatal, $msg) = @_;
+ if ($self->{events}{error}) {
+ $self->{events}{error}->($msg);
+ }
+ else {
+ die $msg if $fatal;
+ }
+ },
($kwargs->{ssl} ?
((defined $kwargs->{tls} ? $kwargs->{tls} : ()),
(defined $kwargs->{tls_ctx} ? $kwargs->{tls_ctx} : ()))

0 comments on commit 8330c54

Please sign in to comment.