Skip to content

Commit e8baf0e

Browse files
committed
simplfy code
1 parent 5fa42fc commit e8baf0e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

cmd/clusterctl/client/repository/repository_github.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,9 @@ func (g *gitHubRepository) handleGithubErr(err error, message string, args ...in
505505
return errors.New("rate limit for github api has been reached. Please wait one hour or get a personal API token and assign it to the GITHUB_TOKEN environment variable")
506506
}
507507

508-
var errorResponse *github.ErrorResponse
509-
if errors.As(err, &errorResponse) {
510-
ghErr := err.(*github.ErrorResponse)
511-
if ghErr.Response.StatusCode == http.StatusNotFound {
512-
return errNotFound
513-
}
508+
var ghErr *github.ErrorResponse
509+
if errors.As(err, &ghErr) && ghErr.Response.StatusCode == http.StatusNotFound {
510+
return errNotFound
514511
}
515512
return errors.Wrapf(err, message, args...)
516513
}

0 commit comments

Comments
 (0)