// One of the alternatives *did* match, but it failed somewhere further down the tree, and we don't have any errors originating from *other* nested rules. Chances are that the user intended to match the failing branch, so we pretend that the other alternatives don't exist, and pass through the original error(s).
returnvalidationResult({errors:nestedErrors});
}else{
thrownewValidationError(`Must satisfy at least one of:`,{
subErrors:unpackNestedEithers(allErrors),
__isValidatemEitherError:true
});
// Somewhere, possibly nested inside of a "must satisfy all", we've seen errors at varying subpaths. This means that the user probably tried to match some sort of arm, but we don't know which, because the origins are not identical. Therefore we will just remove all the top-level errors, and only show the ones that are at *some* sort of sub-path.
throwerrorAtLeastOneOf(nestedErrors);
}
}else{
// We have no idea what the intention was, as there are no nested errors. Just show all of the errors.