Don't attempt to generate function description when the location of a stacktrace frame could not be determined

parse-stacktrace-fix
Sven Slootweg 4 years ago
parent ef9daa1375
commit bae1f0e9fc

@ -142,13 +142,17 @@ module.exports = function aggregrateAndThrowErrors(errors) {
let detailLines = renderErrorList(errors);
let frame = determineLocation();
let functionString = (frame.alias != null)
? `${frame.alias} [${frame.functionName}]`
: frame.functionName;
let locationString = asExpression(() => {
if (frame != null) {
let functionString = (frame.alias != null)
? `${frame.alias} [${frame.functionName}]`
: frame.functionName;
let locationString = (frame != null)
? `${highlightBold(functionString)} in ${highlightBold(frame.shortPath)}, at line ${highlightBold(frame.location.line)} (${frame.location.path})`
: dimBold(`(could not determine location)`);
return `${highlightBold(functionString)} in ${highlightBold(frame.shortPath)}, at line ${highlightBold(frame.location.line)} (${frame.location.path})`;
} else {
return dimBold(`(could not determine location)`);
}
});
return new AggregrateValidationError(`One or more validation errors occurred at ${locationString}:\n${detailLines}`, {
errors: errors

Loading…
Cancel
Save