Skip to content

Commit

Permalink
Convert "Invalid source root" errors to UserErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
aeisenberg committed Oct 4, 2022
1 parent 4cf8004 commit 7c40d0f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
16 changes: 11 additions & 5 deletions lib/init.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/init.js.map

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

10 changes: 7 additions & 3 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ export async function runInit(
}
}
} catch (e) {
// Handle the situation where init is called twice
// for the same database in the same job.
// Check if we need to re-throw the error as a UserError in order to avoid
// counting this error towards our internal error budget.
if (
// Init action called twice
e instanceof Error &&
e.message?.includes("Refusing to create databases") &&
e.message.includes("exists and is not an empty directory.")
Expand All @@ -129,7 +130,10 @@ export async function runInit(
);
} else if (
e instanceof Error &&
e.message?.includes("is not compatible with this CodeQL CLI")
// Version of CodeQL CLI is incompatible with this version of the CodeQL Action
(e.message?.includes("is not compatible with this CodeQL CLI") ||
// Expected source location for database creation does not exist
e.message?.includes("Invalid source root"))
) {
throw new util.UserError(e.message);
} else {
Expand Down

0 comments on commit 7c40d0f

Please sign in to comment.