Skip to content

Commit

Permalink
(improvement) more logging when purl format is invalid (#166)
Browse files Browse the repository at this point in the history
Signed-off-by: Benji Visser <benji@093b.org>
  • Loading branch information
noqcks authored Sep 3, 2023
1 parent 3066879 commit 8db3403
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/purl/purl.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func ShortPurl(pkg pkg.Package) (string, error) {
}
shortPurl := strings.Split(pkg.PURL, "@")
if len(shortPurl) < 2 {
return "", fmt.Errorf("invalid purl")
return "", fmt.Errorf("invalid purl format %s", pkg.PURL)
}
return shortPurl[0], nil
}
2 changes: 1 addition & 1 deletion internal/purl/purl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestShortPurl(t *testing.T) {
input: pkg.Package{
PURL: "invalid",
},
expectedErr: fmt.Errorf("invalid purl"),
expectedErr: fmt.Errorf("invalid purl format invalid"),
},
{
name: "Empty PURL",
Expand Down

0 comments on commit 8db3403

Please sign in to comment.