Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Add error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
mdom committed Mar 11, 2016
1 parent 845b75a commit 1698371
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/App/txtnix/Plugin/LinkBack.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@ sub linkback {
$app->ua->post(
$url => form => { url => $app->twturl } => sub {
my ( $ua, $tx ) = @_;
warn "Couldn't ping back to $url\n" if !$tx->success;
if ( $tx->success ) {
warn "Send ping back to $url.\n";
}
else {
my $prefix = "Couldn't ping back to $url";
my $err = $tx->error;
warn $err
? "$prefix: $err->{code} response: $err->{message}\n"
: "$prefix: Connection error: $err->{message}\n";
}
$end->();
}
);
Expand Down

0 comments on commit 1698371

Please sign in to comment.