From f021326e1f0ac9edd299f3f0a40b1994453aa1ae Mon Sep 17 00:00:00 2001 From: laurentsimon <64505099+laurentsimon@users.noreply.github.com> Date: Thu, 22 Jul 2021 15:00:12 -0700 Subject: [PATCH] catch error (#736) --- checks/branch_protected.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/checks/branch_protected.go b/checks/branch_protected.go index 142ff3cd..bafca1ec 100644 --- a/checks/branch_protected.go +++ b/checks/branch_protected.go @@ -155,10 +155,8 @@ func isBranchProtected(branches []*github.Branch, name string) (bool, error) { func getProtectionAndCheck(ctx context.Context, r repositories, dl checker.DetailLogger, ownerStr, repoStr, branch string) checker.CheckResult { // We only call this if the branch is protected. An error indicates not found. - protection, resp, err := r.GetBranchProtection(ctx, ownerStr, repoStr, branch) - - const fileNotFound = 404 - if resp.StatusCode == fileNotFound { + protection, _, err := r.GetBranchProtection(ctx, ownerStr, repoStr, branch) + if err != nil { e := sce.Create(sce.ErrScorecardInternal, err.Error()) return checker.CreateRuntimeErrorResult(CheckBranchProtection, e) }