Skip to content

Commit

Permalink
Include mkdirSync in try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael B. Gale committed Oct 5, 2023
1 parent a144bf5 commit 3b2fee4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/diagnostics.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/diagnostics.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ export function addDiagnostic(
"codeql-action",
);

// Create the directory if it doesn't exist yet.
mkdirSync(diagnosticsPath, { recursive: true });
try {
// Create the directory if it doesn't exist yet.
mkdirSync(diagnosticsPath, { recursive: true });

const jsonPath = path.resolve(
diagnosticsPath,
`codeql-action-${diagnostic.timestamp}.json`,
);
const jsonPath = path.resolve(
diagnosticsPath,
`codeql-action-${diagnostic.timestamp}.json`,
);

try {
writeFileSync(jsonPath, JSON.stringify(diagnostic));
} catch (err) {
logger.warning(`Unable to write diagnostic message to database: ${err}`);
Expand Down

0 comments on commit 3b2fee4

Please sign in to comment.