Skip to content

Commit 9a82c64

Browse files
committed
Handle errors more gracefully when updating GitHub issue counts
Add proper error handling to the GitHub issue count code. If the repo is missing, we can assume it has been deleted, so we can delete the issue information we have stored. Other errors can get logged and investigated later.
1 parent 128d9ae commit 9a82c64

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/MetaCPAN/Script/Tickets.pm

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ sub index_github_bugs {
119119

120120
my $json = JSON::MaybeXS->new( allow_nonref => 1 );
121121

122-
while ( my $release = $scroll->next ) {
122+
RELEASE: while ( my $release = $scroll->next ) {
123123
my $resources = $release->resources;
124124
my ( $user, $repo, $source )
125125
= $self->github_user_repo_from_resources($resources);
@@ -146,6 +146,22 @@ sub index_github_bugs {
146146
}
147147
END_QUERY
148148

149+
if ( my $error = $data->{error} ) {
150+
for my $error (@$error) {
151+
my $log_message
152+
= "[$release->{distribution}] $error->{message}";
153+
if ( $error->{type} eq 'NOT_FOUND' ) {
154+
delete $summary{ $release->{'distribution'} }{'bugs'}
155+
{'github'};
156+
log_info {$log_message};
157+
}
158+
else {
159+
log_error {$log_message};
160+
}
161+
next RELEASE;
162+
}
163+
}
164+
149165
my $open
150166
= $data->{data}{repository}{openIssues}{totalCount}
151167
+ $data->{data}{repository}{openPullRequests}{totalCount};

0 commit comments

Comments
 (0)