|
|
|
@ -30,7 +30,7 @@ if (supportsColor.stderr) {
|
|
|
|
|
closeColor = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderErrorList(errors, isSubErrors = false) {
|
|
|
|
|
function renderErrorList(errors, subErrorLevels = 0) {
|
|
|
|
|
let rephrasedErrors = errors.map((error, i) => {
|
|
|
|
|
let pathSegments = error.path.map((segment) => {
|
|
|
|
|
if (segment == null) {
|
|
|
|
@ -49,25 +49,23 @@ function renderErrorList(errors, isSubErrors = false) {
|
|
|
|
|
: "└─";
|
|
|
|
|
|
|
|
|
|
let mainLine = asExpression(() => {
|
|
|
|
|
if (pathSegments.length > 0) {
|
|
|
|
|
if (isSubErrors) {
|
|
|
|
|
return ` ${lineCharacter} ${joinPathSegments(pathSegments)}: ${error.message}`;
|
|
|
|
|
} else {
|
|
|
|
|
return ` - At ${joinPathSegments(pathSegments)}: ${error.message}`;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (isSubErrors) {
|
|
|
|
|
return ` ${lineCharacter} ${error.message}`;
|
|
|
|
|
if (subErrorLevels > 0) {
|
|
|
|
|
let message = (pathSegments.length > 0)
|
|
|
|
|
? `${lineCharacter} ${joinPathSegments(pathSegments)}: ${error.message}`
|
|
|
|
|
: `${lineCharacter} ${error.message}`;
|
|
|
|
|
|
|
|
|
|
return indentString(message, subErrorLevels * 4);
|
|
|
|
|
} else {
|
|
|
|
|
return ` - ${error.message}`;
|
|
|
|
|
}
|
|
|
|
|
return (pathSegments.length > 0)
|
|
|
|
|
? ` - At ${joinPathSegments(pathSegments)}: ${error.message}`
|
|
|
|
|
: ` - ${error.message}`;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (error.subErrors != null && error.subErrors.length > 0) {
|
|
|
|
|
let renderedSubErrors = renderErrorList(error.subErrors, true);
|
|
|
|
|
let renderedSubErrors = renderErrorList(error.subErrors, subErrorLevels + 1);
|
|
|
|
|
|
|
|
|
|
return mainLine + "\n" + indentString(renderedSubErrors, 2);
|
|
|
|
|
return mainLine + "\n" + renderedSubErrors;
|
|
|
|
|
} else {
|
|
|
|
|
return mainLine;
|
|
|
|
|
}
|
|
|
|
|