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