Skip to content

Commit 3b2fee4

Browse files
committed
Include mkdirSync in try/catch
1 parent a144bf5 commit 3b2fee4

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/diagnostics.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/diagnostics.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/diagnostics.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ export function addDiagnostic(
9393
"codeql-action",
9494
);
9595

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

99-
const jsonPath = path.resolve(
100-
diagnosticsPath,
101-
`codeql-action-${diagnostic.timestamp}.json`,
102-
);
100+
const jsonPath = path.resolve(
101+
diagnosticsPath,
102+
`codeql-action-${diagnostic.timestamp}.json`,
103+
);
103104

104-
try {
105105
writeFileSync(jsonPath, JSON.stringify(diagnostic));
106106
} catch (err) {
107107
logger.warning(`Unable to write diagnostic message to database: ${err}`);

0 commit comments

Comments
 (0)