@@ -159,16 +159,17 @@ func purlConvert(p purl.PackageURL) (*model.PkgInputSpec, error) {
159159 // so that they can be referenced with higher specificity in GUAC
160160 //
161161 // PURL types not defined in purl library handled generically
162- case "alpine" , "alpm" , "apk" , "huggingface" , " githubactions" , "mlflow" , "qpkg" , "pub" , "swid " , PurlTypeGuac :
162+ case "alpine" , "githubactions" , PurlTypeGuac :
163163 fallthrough
164164 // PURL types defined in purl library handled generically
165165 case purl .TypeBitbucket , purl .TypeCocoapods , purl .TypeCargo ,
166166 purl .TypeComposer , purl .TypeConan , purl .TypeConda , purl .TypeCran ,
167167 purl .TypeDebian , purl .TypeGem , purl .TypeGithub ,
168168 purl .TypeGolang , purl .TypeHackage , purl .TypeHex , purl .TypeMaven ,
169169 purl .TypeNPM , purl .TypeNuget , purl .TypePyPi , purl .TypeRPM , purl .TypeSwift ,
170- purl .TypeGeneric , purl .TypeYocto , purl .TypeCpan :
171- // some code
170+ purl .TypeGeneric , purl .TypeYocto , purl .TypeCpan ,
171+ purl .TypeAlpm , purl .TypeApk , purl .TypeBitnami , purl .TypeHuggingface ,
172+ purl .TypeMLFlow , purl .TypePub , purl .TypeQpkg , purl .TypeSWID :
172173 r := pkg (p .Type , p .Namespace , p .Name , p .Version , p .Subpath , p .Qualifiers .Map ())
173174 return r , nil
174175
@@ -223,9 +224,13 @@ func purlConvert(p purl.PackageURL) (*model.PkgInputSpec, error) {
223224 return r , nil
224225
225226 default :
226- // unhandled types should throw an error so we can make sure to review the
227- // implementation of newly introduced PURL types.
228- return nil , fmt .Errorf ("unhandled PURL type: %s" , p .Type )
227+ if _ , ok := purl .KnownTypes [p .Type ]; ok {
228+ return nil , fmt .Errorf ("unhandled known PURL type: %q. Please report at https://github.com/guacsec/guac/issues/new" , p .Type )
229+ }
230+ if _ , ok := purl .CandidateTypes [p .Type ]; ok {
231+ return nil , fmt .Errorf ("unhandled candidate PURL type: %q. Please report at https://github.com/guacsec/guac/issues/new" , p .Type )
232+ }
233+ return nil , fmt .Errorf ("unsupported PURL type: %q" , p .Type )
229234 }
230235}
231236
0 commit comments