move details limiting back to factory

This commit is contained in:
Tobias Koppers 2022-03-08 08:22:12 +01:00 committed by Ivan Kopeykin
parent c14f1878ca
commit ae9c63cadf
2 changed files with 4 additions and 7 deletions

View File

@ -1823,8 +1823,10 @@ const errorsSpaceLimit = (errors, max) => {
if (fullLength > max) {
result = i > 0 ? errors.slice(0, i) : [];
const overlimit = fullLength - max + 1;
const error = errors[i++];
result.push({
...errors[i++],
...error,
details: error.details.split("\n").slice(0, -overlimit).join("\n"),
filteredDetails: overlimit
});
filtered = errors.length - i;

View File

@ -588,12 +588,7 @@ const SIMPLE_PRINTERS = {
"error.loc": (loc, { green }) => green(loc),
"error.message": (message, { bold, formatError }) =>
message.includes("\u001b[") ? message : bold(formatError(message)),
"error.details": (details, { formatError, error }) => {
if (!error.filteredDetails) return formatError(details);
return formatError(
details.split("\n").slice(0, -error.filteredDetails).join("\n")
);
},
"error.details": (details, { formatError }) => formatError(details),
"error.filteredDetails": filteredDetails =>
filteredDetails ? `+ ${filteredDetails} hidden lines` : undefined,
"error.stack": stack => stack,