mirror of
https://github.com/github/codeql-action.git
synced 2026-01-01 04:00:24 +08:00
Include first 10 errors in exception message
This commit is contained in:
@@ -457,6 +457,8 @@ test("parseUserConfig - throws a ConfigurationError if validation fails", (t) =>
|
||||
),
|
||||
{
|
||||
instanceOf: ConfigurationError,
|
||||
message:
|
||||
'The configuration file "test" is invalid: instance.queries is not of a type(s) array.',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ export function parseUserConfig(
|
||||
throw new ConfigurationError(
|
||||
errorMessages.getInvalidConfigFileMessage(
|
||||
pathInput,
|
||||
`There are ${result.errors.length} error(s)`,
|
||||
result.errors.map((e) => e.stack),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,11 @@ export function getConfigFileParseErrorMessage(
|
||||
|
||||
export function getInvalidConfigFileMessage(
|
||||
configFile: string,
|
||||
detail: string,
|
||||
messages: string[],
|
||||
): string {
|
||||
return `The configuration file "${configFile}" is invalid: ${detail}`;
|
||||
const andMore =
|
||||
messages.length > 10 ? `, and ${messages.length - 10} more.` : ".";
|
||||
return `The configuration file "${configFile}" is invalid: ${messages.slice(0, 10).join(", ")}${andMore}`;
|
||||
}
|
||||
|
||||
export function getConfigFileRepoFormatInvalidMessage(
|
||||
|
||||
Reference in New Issue
Block a user