Add UserError
This commit adds a `UserError` class that should be thrown when the cause of an error is fundamentally from user configuration. When sending status reports, avoid sending a `failure` for `UserError`s. This will prevent our diagnostics from pinging us for errors outside of our control.
This commit is contained in:
parent
040feefecf
commit
3d93bb2ac9
21 changed files with 96 additions and 34 deletions
8
lib/init.js
generated
8
lib/init.js
generated
|
|
@ -47,7 +47,7 @@ async function initConfig(languagesInput, queriesInput, packsInput, configFile,
|
|||
}
|
||||
exports.initConfig = initConfig;
|
||||
async function runInit(codeql, config, sourceRoot, processName, processLevel) {
|
||||
var _a;
|
||||
var _a, _b;
|
||||
fs.mkdirSync(config.dbLocation, { recursive: true });
|
||||
try {
|
||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
||||
|
|
@ -67,7 +67,11 @@ async function runInit(codeql, config, sourceRoot, processName, processLevel) {
|
|||
if (e instanceof Error &&
|
||||
((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes("Refusing to create databases")) &&
|
||||
e.message.includes("exists and is not an empty directory.")) {
|
||||
throw new Error(`Is the "init" action called twice in the same job? ${e.message}`);
|
||||
throw new util.UserError(`Is the "init" action called twice in the same job? ${e.message}`);
|
||||
}
|
||||
else if (e instanceof Error &&
|
||||
((_b = e.message) === null || _b === void 0 ? void 0 : _b.includes("is not compatible with this CodeQL CLI"))) {
|
||||
throw new util.UserError(e.message);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue