Skip to content

Commit

Permalink
Turn PURL parse error into a warning (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keegan Saunders authored May 22, 2024
1 parent 585eced commit ce7e7dc
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
Expand Up @@ -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(
Expand Down

0 comments on commit ce7e7dc

Please sign in to comment.