confess on all redis errors
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 29 Aug 2010 11:39:00 +0000 (13:39 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 29 Aug 2010 11:39:00 +0000 (13:39 +0200)
scripts/mqr-irc-client.pl
scripts/mqr-xmpp-client.pl

index fab919a..58d4374 100755 (executable)
@@ -11,6 +11,7 @@ use AnyEvent::IRC::Client;
 use AnyEvent::IRC::Util qw/mk_msg parse_irc_msg encode_ctcp/;
 use AnyEvent::Redis;
 use Data::Dump qw(dump);
+use Carp qw(confess);
 
 my $nick = $ENV{IRC_NICK} || die "IRC_NICK";
 my $room = $ENV{IRC_ROOM} || die "IRC_ROOM";
@@ -21,8 +22,8 @@ my $c = AnyEvent->condvar;
 my $stdout = AnyEvent::Handle->new (fh => \*STDOUT);
 my $con = new AnyEvent::IRC::Client;
 
-my $pub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { warn @_ } );
-my $sub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { warn @_ } );
+my $pub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { confess @_ } );
+my $sub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { confess @_ } );
 
 $sub->psubscribe( 'channel *', sub {
        my ( $message, $from ) = @_;
index ba191c2..64d4d65 100755 (executable)
@@ -10,6 +10,7 @@ use AnyEvent::XMPP::Namespaces qw/xmpp_ns/;
 use AnyEvent::Redis;
 use Data::Dump qw(dump);
 use Encode;
+use Carp qw(confess);
 
 binmode STDOUT, ":utf8";
 
@@ -29,8 +30,8 @@ $cl->set_presence(undef, 'I\'m a talking bot.', 1);
 $cl->add_account ($jid, $pw);
 warn "connecting to $jid...\n";
 
-my $pub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { warn @_ } );
-my $sub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { warn @_ } );
+my $pub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { confess @_ } );
+my $sub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { confess @_ } );
 
 our $contacts;