diff options
author | dakkar <dakkar@thenautilus.net> | 2018-06-29 14:41:12 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2018-06-29 14:41:59 +0000 |
commit | 003db36ba6a6e8a5817f390bfc209196caecfc1e (patch) | |
tree | f8a810e200df3312859071e28499040cc4abd6a1 /tweet-archive.pl | |
parent | index the tweets (diff) | |
download | tweet-archive-003db36ba6a6e8a5817f390bfc209196caecfc1e.tar.gz tweet-archive-003db36ba6a6e8a5817f390bfc209196caecfc1e.tar.bz2 tweet-archive-003db36ba6a6e8a5817f390bfc209196caecfc1e.zip |
print HTTP conversation on errors
Diffstat (limited to 'tweet-archive.pl')
-rw-r--r-- | tweet-archive.pl | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tweet-archive.pl b/tweet-archive.pl index 2424206..b78540f 100644 --- a/tweet-archive.pl +++ b/tweet-archive.pl @@ -21,11 +21,25 @@ my $conf = $json_parser->decode( my $client = Dakkar::TweetArchive->new($conf); my $store = Dakkar::TweetArchive::Store->new($conf); -my $latest_id = $store->latest_tweet_id; +my $ua = $client->client->ua; +my @responses; +$ua->add_handler( response_done => sub { push @responses, $_[0]; return } ); -for my $tweet ($client->home_timeline($latest_id)->@*) { - $store->store_tweet($tweet); -} +eval { + my $latest_id = $store->latest_tweet_id; -$store->store_friends($client->friends); -$store->store_followers($client->followers); + for my $tweet ($client->home_timeline($latest_id)->@*) { + $store->store_tweet($tweet); + } + + $store->store_friends($client->friends); + $store->store_followers($client->followers); + 1; +} or do { + print "Fail: $@\n"; + for my $res (@responses) { + print $res->request->as_string; + print $res->as_string; + print "\n",'-' x 50,"\n\n"; + } +}; |