Skip to content

Commit ba8ff05

Browse files
aegilopsCopilot
andauthored
Update src/componentDetection.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 5ac59f7 commit ba8ff05

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/componentDetection.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ export default class ComponentDetection {
119119
public async getManifestsFromResults(file: string, path: string): Promise<Manifest[] | undefined> {
120120
console.debug(`Reading results from ${file}`);
121121
const results = await fs.readFileSync(file, 'utf8');
122-
const json: any = JSON.parse(results);
122+
let json: any;
123+
try {
124+
json = JSON.parse(results);
125+
} catch (err: any) {
126+
throw new Error(`Failed to parse JSON results from component-detection output file "${file}": ${err instanceof Error ? err.message : String(err)}`);
127+
}
123128

124129
let dependencyGraphs: DependencyGraphs = this.normalizeDependencyGraphPaths(json.dependencyGraphs, path);
125130

0 commit comments

Comments
 (0)