Skip to content

Commit

Permalink
fix: handle unsuccessful Snyk API responses (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcombuechen authored Jul 19, 2024
1 parent 3bfc605 commit 689562a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/snyk/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package snyk

import (
"context"
"fmt"
"net/http"

"github.com/deepmap/oapi-codegen/pkg/securityprovider"
"github.com/google/uuid"
Expand Down Expand Up @@ -96,5 +98,9 @@ func GetPackageVulnerabilities(purl *packageurl.PackageURL, auth *securityprovid
return nil, err
}

if resp.StatusCode() != http.StatusOK {
return resp, fmt.Errorf("unsuccessful request (%s)", resp.Status())
}

return resp, nil
}

0 comments on commit 689562a

Please sign in to comment.