Bring error message method name inline with others
This commit is contained in:
parent
a66f2b0b11
commit
51becd2cf8
6 changed files with 9 additions and 9 deletions
6
lib/config-utils.js
generated
6
lib/config-utils.js
generated
|
|
@ -147,12 +147,12 @@ function getConfigFileDoesNotExistErrorMessage(configFile) {
|
||||||
return 'The configuration file "' + configFile + '" does not exist';
|
return 'The configuration file "' + configFile + '" does not exist';
|
||||||
}
|
}
|
||||||
exports.getConfigFileDoesNotExistErrorMessage = getConfigFileDoesNotExistErrorMessage;
|
exports.getConfigFileDoesNotExistErrorMessage = getConfigFileDoesNotExistErrorMessage;
|
||||||
function getConfigFileRepoFormatInvalid(configFile) {
|
function getConfigFileRepoFormatInvalidMessage(configFile) {
|
||||||
let error = 'The configuration file "' + configFile + '" is not a supported remote file reference.';
|
let error = 'The configuration file "' + configFile + '" is not a supported remote file reference.';
|
||||||
error += ' Expected format <owner>/<repository>/<file-path>@<ref>';
|
error += ' Expected format <owner>/<repository>/<file-path>@<ref>';
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
exports.getConfigFileRepoFormatInvalid = getConfigFileRepoFormatInvalid;
|
exports.getConfigFileRepoFormatInvalidMessage = getConfigFileRepoFormatInvalidMessage;
|
||||||
function getConfigFilePropertyError(configFile, property, error) {
|
function getConfigFilePropertyError(configFile, property, error) {
|
||||||
return 'The configuration file "' + configFile + '" is invalid: property "' + property + '" ' + error;
|
return 'The configuration file "' + configFile + '" is invalid: property "' + property + '" ' + error;
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +248,7 @@ async function getRemoteConfig(configFile) {
|
||||||
const pieces = format.exec(configFile);
|
const pieces = format.exec(configFile);
|
||||||
// 5 = 4 groups + the whole expression
|
// 5 = 4 groups + the whole expression
|
||||||
if (pieces === null || pieces.groups === undefined || pieces.length < 5) {
|
if (pieces === null || pieces.groups === undefined || pieces.length < 5) {
|
||||||
throw new Error(getConfigFileRepoFormatInvalid(configFile));
|
throw new Error(getConfigFileRepoFormatInvalidMessage(configFile));
|
||||||
}
|
}
|
||||||
const response = await api.client.repos.getContents({
|
const response = await api.client.repos.getContents({
|
||||||
owner: pieces.groups.owner,
|
owner: pieces.groups.owner,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
2
lib/config-utils.test.js
generated
2
lib/config-utils.test.js
generated
|
|
@ -79,7 +79,7 @@ ava_1.default("load non-local input with invalid repo syntax", async (t) => {
|
||||||
throw new Error('loadConfig did not throw error');
|
throw new Error('loadConfig did not throw error');
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
t.deepEqual(err, new Error(configUtils.getConfigFileRepoFormatInvalid('octo-org/codeql-config@main')));
|
t.deepEqual(err, new Error(configUtils.getConfigFileRepoFormatInvalidMessage('octo-org/codeql-config@main')));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -82,7 +82,7 @@ test("load non-local input with invalid repo syntax", async t => {
|
||||||
await configUtils.loadConfig();
|
await configUtils.loadConfig();
|
||||||
throw new Error('loadConfig did not throw error');
|
throw new Error('loadConfig did not throw error');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
t.deepEqual(err, new Error(configUtils.getConfigFileRepoFormatInvalid('octo-org/codeql-config@main')));
|
t.deepEqual(err, new Error(configUtils.getConfigFileRepoFormatInvalidMessage('octo-org/codeql-config@main')));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ export function getConfigFileDoesNotExistErrorMessage(configFile: string): strin
|
||||||
return 'The configuration file "' + configFile + '" does not exist';
|
return 'The configuration file "' + configFile + '" does not exist';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getConfigFileRepoFormatInvalid(configFile: string): string {
|
export function getConfigFileRepoFormatInvalidMessage(configFile: string): string {
|
||||||
let error = 'The configuration file "' + configFile + '" is not a supported remote file reference.';
|
let error = 'The configuration file "' + configFile + '" is not a supported remote file reference.';
|
||||||
error += ' Expected format <owner>/<repository>/<file-path>@<ref>';
|
error += ' Expected format <owner>/<repository>/<file-path>@<ref>';
|
||||||
|
|
||||||
|
|
@ -283,7 +283,7 @@ async function getRemoteConfig(configFile: string): Promise<any> {
|
||||||
const pieces = format.exec(configFile);
|
const pieces = format.exec(configFile);
|
||||||
// 5 = 4 groups + the whole expression
|
// 5 = 4 groups + the whole expression
|
||||||
if (pieces === null || pieces.groups === undefined || pieces.length < 5) {
|
if (pieces === null || pieces.groups === undefined || pieces.length < 5) {
|
||||||
throw new Error(getConfigFileRepoFormatInvalid(configFile));
|
throw new Error(getConfigFileRepoFormatInvalidMessage(configFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await api.client.repos.getContents({
|
const response = await api.client.repos.getContents({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue