Omit '(root)' specifier entirely

parse-stacktrace-fix
Sven Slootweg 4 years ago
parent 1cc19bff3e
commit 27beee88f0

@ -23,6 +23,7 @@
"@validatem/normalize-rules": "^0.1.0",
"@validatem/required": "^0.1.0",
"@validatem/validation-result": "^0.1.1",
"as-expression": "^1.0.0",
"assure-array": "^1.0.0",
"create-error": "^0.3.1",
"default-value": "^1.0.0",

@ -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);

Loading…
Cancel
Save