Skip to content

Commit 9c4801b

Browse files
author
Anivar A Aravind
committed
topdown: Include both input and error details in PURL parse errors
As suggested by @srenatus, error messages now include both the invalid input string (quoted with %q) and the underlying parser error. This provides better debugging information when parsing fails. Example: invalid PURL "bad-input": parse error details
1 parent f38a814 commit 9c4801b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

v1/topdown/purl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func builtinPurlParse(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Ter
3131

3232
purl, err := packageurl.FromString(string(str))
3333
if err != nil {
34-
return fmt.Errorf("invalid PURL: %s", str)
34+
return fmt.Errorf("invalid PURL %q: %s", str, err)
3535
}
3636

3737
// Handle qualifiers - always return an object (empty if no qualifiers)

0 commit comments

Comments
 (0)