Include first 10 errors in exception message

This commit is contained in:
Michael B. Gale
2025-10-14 18:56:50 +01:00
parent 0822fb12e7
commit d7a8ae5fdd
4 changed files with 11 additions and 6 deletions
+4 -3
View File
@@ -87762,8 +87762,9 @@ function getConfigFileDoesNotExistErrorMessage(configFile) {
function getConfigFileParseErrorMessage(configFile, message) {
return `Cannot parse "${configFile}": ${message}`;
}
function getInvalidConfigFileMessage(configFile, detail) {
return `The configuration file "${configFile}" is invalid: ${detail}`;
function getInvalidConfigFileMessage(configFile, messages) {
const andMore = messages.length > 10 ? `, and ${messages.length - 10} more.` : ".";
return `The configuration file "${configFile}" is invalid: ${messages.slice(0, 10).join(", ")}${andMore}`;
}
function getConfigFileRepoFormatInvalidMessage(configFile) {
let error2 = `The configuration file "${configFile}" is not a supported remote file reference.`;
@@ -88071,7 +88072,7 @@ function parseUserConfig(logger, pathInput, contents) {
throw new ConfigurationError(
getInvalidConfigFileMessage(
pathInput,
`There are ${result.errors.length} error(s)`
result.errors.map((e) => e.stack)
)
);
}