|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
const indentString = require("indent-string");
|
|
|
|
|
const supportsColor = require("supports-color");
|
|
|
|
|
const matchVirtualProperty = require("@validatem/match-virtual-property");
|
|
|
|
|
const asExpression = require("as-expression");
|
|
|
|
|
|
|
|
|
|
const AggregrateValidationError = require("./aggregrate-validation-error");
|
|
|
|
|
|
|
|
|
@ -47,10 +48,21 @@ function renderErrorList(errors, isSubErrors = false) {
|
|
|
|
|
? "├─"
|
|
|
|
|
: "└─";
|
|
|
|
|
|
|
|
|
|
let mainLine = (isSubErrors)
|
|
|
|
|
// ? `... -> ${joinPathSegments(pathSegments)}: ${error.message}`
|
|
|
|
|
? ` ${lineCharacter} ${joinPathSegments(pathSegments)}: ${error.message}`
|
|
|
|
|
: ` - At ${joinPathSegments(pathSegments)}: ${error.message}`;
|
|
|
|
|
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}`;
|
|
|
|
|
} else {
|
|
|
|
|
return ` - ${error.message}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (error.subErrors != null && error.subErrors.length > 0) {
|
|
|
|
|
let renderedSubErrors = renderErrorList(error.subErrors, true);
|
|
|
|
|