Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn PURL parse error into a warning
Browse files Browse the repository at this point in the history
Keegan Saunders committed May 22, 2024
1 parent 585eced commit b5ce793
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/nowsecure-snapshot.ts
Original file line number Diff line number Diff line change
@@ -66,8 +66,14 @@ export function convertToSnapshot(

const purl = encodePurl(ecosystem, component.name, component.version);

manifest.addDirectDependency(new Package(purl));
manifests[source] = manifest;
try {
const pkg = new Package(purl);
manifest.addDirectDependency(pkg);
manifests[source] = manifest;
} catch (e) {
// Add some additional context about the PURL that failed to be parsed.
console.warn(`${(e as Error).message} (PURL is '${purl}')`);
}
}

const snapshot = new Snapshot(

0 comments on commit b5ce793

Please sign in to comment.