Skip to content

Commit

Permalink
Handdled errors close to the functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed Jul 2, 2024
1 parent 9412d59 commit b35a96c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,10 @@ export function processAndDisplayBuildSummary() {
const runId = process.env.GITHUB_RUN_ID || '';
const runnerTemp = process.env.RUNNER_TEMP || '';

let taskSummaryTableRows;
try {
const filePath: string = join(runnerTemp, `buildSummary${runId}.json`);
const data = JSON.parse(readFileSync(filePath, { encoding: 'utf8' }));
taskSummaryTableRows = getBuildSummaryTable(data);
} catch (e) {
console.error('An error occurred while reading the build summary file:', e);
return;
}
const filePath: string = join(runnerTemp, `buildSummary${runId}.json`);
const data = JSON.parse(readFileSync(filePath, { encoding: 'utf8' }));
const taskSummaryTableRows = getBuildSummaryTable(data);

writeSummary(taskSummaryTableRows);
}

0 comments on commit b35a96c

Please sign in to comment.