Skip to content

Commit 642850b

Browse files
committed
Add special case for "No code seen" error
1 parent 5fa6bd2 commit 642850b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/finalize-db.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,15 @@ async function runQueries(databaseFolder: string, sarifFolder: string, config: c
128128

129129
const sarifFile = path.join(sarifFolder, database + '.sarif');
130130

131-
await codeql.databaseAnalyze(path.join(databaseFolder, database), sarifFile, querySuite);
131+
try {
132+
await codeql.databaseAnalyze(path.join(databaseFolder, database), sarifFile, querySuite);
133+
} catch (analysisError) {
134+
if (analysisError.contains("exit code 32")) {
135+
throw new Error('Unable to analyze ' + database + ' because CodeQL was unable to detect any code for that language. \n [Learn more](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning) about how to troubleshoot this error. ')
136+
} else {
137+
throw new Error(analysisError);
138+
}
139+
}
132140

133141
core.debug('SARIF results for database ' + database + ' created at "' + sarifFile + '"');
134142
core.endGroup();

0 commit comments

Comments
 (0)