diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/githubexplorer/Repository.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/githubexplorer/Repository.pm b/lib/githubexplorer/Repository.pm index 664d727..90adcd0 100644 --- a/lib/githubexplorer/Repository.pm +++ b/lib/githubexplorer/Repository.pm @@ -3,6 +3,7 @@ use 5.010; use Moose::Role; use Net::GitHub::V2::Repositories; use YAML::Syck; +use Try::Tiny; sub fetch_repositories { my ( $self, $profile ) = @_; @@ -15,9 +16,9 @@ sub fetch_repositories { my $repo_list = $github_profile->list(); - while ( ref $repo_list ne 'ARRAYREF' ) { + if ( ref $repo_list ne 'ARRAY' ) { sleep(60); - $repo_list = $github_profile->list(); + return; } foreach my $repos (@$repo_list) { @@ -41,9 +42,9 @@ sub fetch_repositories { token => $self->api_token, ); my $langs = $api_repos->languages; - while ( ref $langs ne 'HASHREF' ) { + if ( ref $langs ne 'HASH' ) { sleep(60); - $langs = $api_repos->languages; + next; } foreach my $lang ( keys %$langs ) { |
